i have the element like this, i want to extract the only this text Pakistani Suits Buy 1 Get 1 Free Anniversary Sale 4 Days Dhamaka Offer @hydetabadshopping , how can i do this using UiPath give me step by step guide
“<yt-formatted-stringid=“video-title” class=“style-scope ytd-rich-grid-media” aria-label=“Pakistani Suits Buy 1 Get 1 Free Anniversary Sale 4 Days Dhamaka Offer @hydetabadshopping by Hyderabad Shopping 522 views 3 hours ago 13 minutes, 41 seconds” data-UiPath_custom_id_23_10_71_64399=“439”>Pakistani Suits Buy 1 Get 1 Free Anniversary Sale 4 Days Dhamaka Offer @hydetabadshopping”
Hi @Adithyeshwar_goud
To get data from a YouTube video using UiPath, you can follow these steps:
- Install the “UiPath.Web.Activities” package in UiPath Studio.
- Create a new workflow in UiPath Studio.
- Drag and drop the “Open Browser” activity from the “Activities” panel onto your workflow.
- In the properties of the “Open Browser” activity, specify the URL of the YouTube video you want to extract data from.
- Add a “Delay” activity after the “Open Browser” activity. This delay will allow the video page to load fully before extracting data.
- Drag and drop the “Get Text” activity from the “Activities” panel onto your workflow.
- Indicate the element on the YouTube page that contains the data you want to extract. (This could be the video title, description, comments, or any other relevant information.)
- Create a variable to store the extracted data. In the “Properties” panel of the “Get Text” activity, locate the “Output” property, click on the field next to it, and create a new variable of the appropriate data type (e.g., String, List, etc.).
- Add additional activities as needed to extract other data from the YouTube video.
Ex: You can use the “Get Attribute” activity to extract the video duration or the “Find Children” activity to extract comments.
- Save your workflow and run it to extract the desired data from the YouTube video.
i need specific title for all the videos in the channel
Hi @Adithyeshwar_goud,
Then instead of “Get Text” activity refer these steps:
- Activities to extract the video titles from the YouTube channel:
- Drag and drop the “Find Children” activity from the “Activities” panel onto your workflow.
- Indicate the element on the YouTube channel page that contains the video titles. This could be the container element that holds all the videos on the channel.
- In the properties of the “Find Children” activity, specify the selector or search criteria to identify the individual video title elements.
- Create a variable to store the extracted titles. Set the variable type as a collection of strings (e.g.,
**List<String>**).
- Use a “For Each” loop activity to iterate through each video title element.
- Within the loop, use a “Get Text” activity to extract the text from each video title element.
- Append the extracted title to the variable created in step 4 using the “Add To Collection” activity.
- After the loop, you will have a collection (list) of video titles stored in the variable.
- You can use additional activities to process or display the extracted titles as per your requirements. For example, you can use a “Message Box” activity to display each title or write them to a file.
- Save your workflow and run it.