Sign in to follow this  
Followers 0
gottygolly

Apostrophe with _InetGetSource()

2 posts in this topic

Curious how I would go about getting the apostrophe to show up when I find the name of the video from youtube.

I want to be able to put the name of the video in the traytip when it shows up.

I searched around via google and found this but couldn't get it to work.

#include<array.au3>
#include<ie.au3>
#include <Inet.au3>
#include <String.au3>
$gui = GUICreate("",640,480,-1,-1)
Opt("GUIOnEventMode",1)
$inet = _INetGetSource("https://www.youtube.com/user/TopTrendingTV/videos")
$inet2 = _StringBetween($inet,"<li class="&'"channels-content-item yt-shelf-grid-item"'&">","</li>")
$inet3 = _StringBetween($inet2[0],"data-context-item-id="&'"','"')
$vid_title = _StringBetween($inet,"<a class="&'"yt-uix-sessionlink yt-uix-tile-link  spf-link  yt-ui-ellipsis yt-ui-ellipsis-2" dir="ltr" title="','"  aria-describedby=')
$x = 0
Local $sec = @SEC
$ini_r78 = IniRead(@scriptdir&"\lastvid.ini","ID","ID","Error")
If $ini_r78 == $inet3[0] Then
    Else
    TrayTip("NEW","A new video has been uploaded!",1)
    IniWrite(@scriptdir&"\lastvid.ini","ID","ID",$inet3[0])
EndIf
ToolTip("Running...",0,0)
GUISetOnEvent(-3,"_Exit")
$inet6 = _StringBetween($inet,"<a class="&'"yt-uix-sessionlink yt-uix-tile-link  spf-link  yt-ui-ellipsis yt-ui-ellipsis-2" dir="ltr" title="','"  aria-describedby=')
$edit = GUICtrlCreateEdit($inet6[0],0,0,640,480)
GuiSetState()

While 1
    $s = @SEC
    If $s <> $sec Then
        $x += 1
        If $x = 60 Then
            $x = 0
            _Call()
        EndIf
        $sec = $s
    EndIf
Sleep(10)
Wend

Func _Exit()
Exit
EndFunc

Func _Call()
$inetl = _INetGetSource("https://www.youtube.com/user/TopTrendingTV/videos")
$inet2l = _StringBetween($inetl,"<li class="&'"channels-content-item yt-shelf-grid-item"'&">","</li>")
$inet3l = _StringBetween($inet2l[0],"data-context-item-id="&'"','"')
$vid_title = _StringBetween($inet,"<a class="&'"yt-uix-sessionlink yt-uix-tile-link  spf-link  yt-ui-ellipsis yt-ui-ellipsis-2" dir="ltr" title="','"  aria-describedby=')
If $inet3l[0] <> $inet3[0] Then
    IniWrite(@scriptdir&"\lastvid.ini","ID","ID",$inet3l[0])
    MsgBox(0,"New Video","There was a new video posted")
EndIf
EndFunc

Func _Uploader()
    $read = GUICtrlRead($uploader)
    GUICtrlSetData($person,"Youtube Channel: "&$read)
    GUICtrlSetData($uploader,"")
EndFunc

Func _Check()
    $ini_r = IniRead(@scriptdir&"\lastvid.ini","ID","ID","Error")
EndFunc

Thanks in advance!

Share this post


Link to post
Share on other sites



StringReplace() completely slipped my mind, I used that to fix the error.

$inet6 = _StringBetween($inet,"<a class="&'"yt-uix-sessionlink yt-uix-tile-link  spf-link  yt-ui-ellipsis yt-ui-ellipsis-2" dir="ltr" title="','"  aria-describedby=')
$ex = StringInStr($inet6[0],"&#39;")
$text_of = $inet6[0]
If $ex = True Then
    $text_of = StringReplace($inet6[0],"&#39;","'")
EndIf
$edit = GUICtrlCreateEdit($text_of,0,0,640,480)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0