Prioritize and select only one of multiple possible elements containing values that may or may not exist

Describe the problem.
Need to select only one of multiple possible existing elements in a prioritized order. Elements contain video download links and text that indicates quality of video. I want to select the highest quality video available on each page. The possible values I want to choose from are "Full HD", "720 HD", "High Quality". Depending on the page, some of these options may not exist. If "Full HD" does not exist I want to choose "720 HD", if neither "Full HD" nor "720 HD" exist, I want to choose "High Quality".

See inspector output of the relevant section from web page:

<ul class="dropdown downloaddropdown">
							<li class="howto">To download, right click and select save as.</li>
																																																																																																																																																																											<li><a href="/example/videos//repository/example_video/mp48000/example_video.mp4" target="_blank" title="Right click the link below and select save as to download:">
											Full HD (Highest) (1247.9 MB) </a></li>
																																						<li><a href="/example/videos//repository/example_video/wmv3000/example_video.wmv" target="_blank" title="Right click the link below and select save as to download:">
											High Quality (480.3 MB) </a></li>
																																																																																																																																																																																																																																																	<li><a href="/example/videos//repository/example_video/mp45000/example_video.mp4" target="_blank" title="Right click the link below and select save as to download:">
											720 HD (Medium) (789.2 MB) </a></li>
																																																																								<li><a href="/example/videos//repository/example_video/mp42000/example_video.mp4" target="_blank" title="Right click the link below and select save as to download:">
											Standard (331.6 MB) </a></li>

I am not very familiar with html code or css selectors. The way that site looks, is when you hover over the "download" button, a menu pops up where you see the available download options - Full HD (Highest) (1247.9 MB), 720 HD (Medium) (789.2 MB), etc...

Note, the site in question requires authentication, so there is no point in providing the actual site. I've obfuscated the actual site and replaced it with ""

Currently, my sitemap is configured where it will select a specific position on that menu, however, the highest quality option does not necessarily fall into that position every time.

Also, is there a more efficient way to spit out the video link without using a link selector by actually clicking the link?


{"_id":"examplevideosite","startUrl":["[1-64]&s=d"],"selectors":[{"id":"videolinks","parentSelectors":["_root"],"type":"SelectorLink","selector":".update_details a:nth-of-type(2)","multiple":true,"delay":0},{"id":"videodowload","parentSelectors":["videolinks"],"type":"SelectorLink","selector":".dropdown li:nth-of-type(2) a","multiple":false,"delay":0},{"id":"title","parentSelectors":["videolinks"],"type":"SelectorText","selector":".title_bar span","multiple":false,"delay":0,"regex":""}]}

@wenj2323 Hi. Have you tried using the ':contains()' selector?

For example:

li:contains('Full HD'), li:contains('720'), li:contains('High Quality')

Learn more: Web Scraper << How to >> Select elements that contain specific text

I did get it working the way I wanted to. I was thrown off because if you click "Element preview" while creating the selectors, even with "multiple" unchecked, it selects all the elements defined by the comma separated values. However when you actually scrape, it only selects the first match in the order defined. My element selector currently looks like this.

.dropdown li:nth-of-type(n+2) a:contains("Full HD"),a:contains("Highest"),a:contains("720 HD")

For clarity, pages that don't contain videos in "Full HD" or "720 HD" format have an alternative video labeled "Highest". This works the way it is supposed to.

Here is the full sitemap that works:

{"_id":"examplewebsite","startUrl":["[1-33]&s=n"],"selectors":[{"id":"MainLinks","parentSelectors":["_root"],"type":"SelectorLink","selector":".update_details a:nth-of-type(1)","multiple":true,"delay":0},{"id":"ElementFilterHighest","parentSelectors":["ClickVidsLinks"],"type":"SelectorElement","selector":".dropdown li:nth-of-type(n+2) a:contains(\"Full HD\"),a:contains(\"Highest\"),a:contains(\"720 HD\")","multiple":false,"delay":0},{"id":"VideoDownloadLink","parentSelectors":["ElementFilterHighest"],"type":"SelectorLink","selector":"_parent_","multiple":false,"delay":0},{"id":"SubPageVidLinks","parentSelectors":["MainLinks"],"type":"SelectorElement","selector":".update_details a:nth-of-type(2)[href*=\"vids\"]","multiple":true,"delay":0},{"id":"ClickVidsLinks","parentSelectors":["SubPageVidLinks"],"type":"SelectorLink","selector":"_parent_","multiple":true,"delay":0}]}