Jump to content
UBot Underground

Scrape Attribute Question


Recommended Posts

Hi folks, 

 

OK, first question.

 

I made a Bot to scrape Youtube video codes from links on the Video manager page.

 

The html is:

 

<a href="/watch?v=-55U2DIeAYw" class="vm-video-title-content yt-uix-sessionlink" data-sessionlink="ei=CJzZ_Z2XorUCFcuBIQod82TudA%3D%3D">My Movie</a>

 

I use attribute href to give me /watch?v=-55U2DIeAYw, and add this to a list, then table, then save. It works the way I want but I only really want to scrape the code.after v=. How would I go about this when writing the bot? 

 

Thanks,

 

Dave

 

 

Link to post
Share on other sites

  • You can either use regex directly when scraping, or
  • you can scrape just like you did and

    manipulate the text string after that with $replace or other combinations of text functions, as needed.

Link to post
Share on other sites

That is exactly what I'm after. I actually need to replace the start and add a bit to the end. I take it you can do that with text functions?

 

I have no idea about Regex (yet!)

 

Thanks for the reply. Much appreciated.

 

Best wishes

 

Dave

Link to post
Share on other sites

this should do the trick:

 

 

set(#scraped, "<a href=\"/watch?v=-55U2DIeAYw\" class=\"vm-video-title-content yt-uix-sessionlink\" data-sessionlink=\"ei=CJzZ_Z2XorUCFcuBIQod82TudA%3D%3D\">My Movie</a>", "Global")
set(#index, $find index(#scraped, "v="), "Global")
set(#index2, $find index(#scraped, "class"), "Global")
set(#result, $substring(#scraped, $add(#index, 2), $subtract($subtract(#index2, 4), #index)), "Global")
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...