I am a fresher to uipath, so am difficult with one task. I need to search a keyword like "rpa" in youtube and extract the 1st 100 video name, url and views. I don't know how to find this solved . Can anyone with better knowledge can help me with this?
Hi @sidhaarthcrazy ,
Thanks for reaching out to UiPath community.
Here is one easy solution you can look to,
Open Browser:
Drag the “Open Browser” activity and enter the YouTube URL.
Search for “RPA”:
Use the “Type Into” activity to input “RPA” into the search bar and press Enter.
Scrape Data:
Use the “Data Scraping” wizard:
Indicate the first video name, URL, and view count.
Let UiPath detect the pattern to scrape subsequent data.
Save the scraped data to a Data Table.
Loop through the Data:
Use a “For Each Row” activity to iterate through the data Table obtained from scraping.
Within the loop, access the video name, URL, and view count of each row.
Perform actions such as logging this information, storing it in a file, or any other required operation.
You have to use the Ui Automation to automate the process.
Here is the step by step code -
→ Use the Use application\browser activity and indicate the Youtube Homepage.
→ Inside use application\browser insert the type into activity and indicate the search bar.
→ Give the “RPA” in type into activity field.
→ After Typeinto give the Keyboard shortcuts and add enter to it.
→ Then Use the Extract datatable activity and hit on add row and indicate which elements you want to extract as datatable.
→ The Output of Extract datatable activity is Datatable datatype, let’s call the variable name as dt_Extracted.
Note - In some times, some of the video details be extracted for that we have to loop together and use the mouse scroll activity to scrap the 100 details.
@pratik.maskar , @mkankatala
Thanks for the reply. First of all I used Data Scraping but data scraping wizard didn’t work for this format. You know that youtube search details doesnot have any pages. The result comes in a single page, once we scroll down and another results will come. From this I need to extract 1st 100 details. Is there any other way?
For that I already mentioned in my above post.
Use the Mouse scroll activity to scroll down the page, use a while or any other activity to loop the process.
Inside while insert the Extract datatable activity to extract the datatable and after extract datatable insert the Mouse scroll activity to scroll down, this process will iterate until 100 rows extraction.
Check the Append results option in Extract Table data activity to append all the results in one datatable.
Thanks , now I added extract table and scroll activity inside while loop with condition Count <= 100 where as count is assigned with 1. after that how will I append the result into datatable? Could you help me with that?
Okay @sidhaarthcrazy If you are using the Extract table data activity open the properties panel check the option called Append Range it will append all the results to one datatable.
Yeah great that’s work Thank you so much. but in table extraction I select video title, url & views, capturing title comes empty so I captured only url and views. How to get the title and insert into data table? Could help me with this?
@mkankatala Now I used another method, I used get text activity to extract title by customize the selectors. Then I added into datatable( dt_title) with only title, now I need to combine the dt_title with dt_results where dt_results table had my url & views. Can you help me with this?
→ Use a Build datatable activity to build a new datatable called Outputdatatable and create columns in it URL Views and Title.
→ After using every Get text activity it will store the data in a variable instead of storing in other datatable.
→ Use for each row in datatable activity to iterate the datatable which contains the URL and views.
→ Inside for each use the add data row activity to add the values of URL, views from datatable and Title from the output of Gettext activity.