Arran'sDad 1 Posted February 6, 2013 Report Share Posted February 6, 2013 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 Quote Link to post Share on other sites
VaultBoss 310 Posted February 6, 2013 Report Share Posted February 6, 2013 You can either use regex directly when scraping, oryou can scrape just like you did andmanipulate the text string after that with $replace or other combinations of text functions, as needed. Quote Link to post Share on other sites
Arran'sDad 1 Posted February 6, 2013 Author Report Share Posted February 6, 2013 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 Quote Link to post Share on other sites
VaultBoss 310 Posted February 6, 2013 Report Share Posted February 6, 2013 I take it you can do that with text functions? yep Quote Link to post Share on other sites
bestmacros 60 Posted February 9, 2013 Report Share Posted February 9, 2013 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") Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.