Reputation: 21
So i want to create a python application which downloads images & videos from instagram-stories. The images are no problem, but the videos are. Because the src isnt't simply in the video. Instead it is like this:
<video class="FOO" ....... autoplay>
<source src="BAR" .....>
</video>
I adressed it in the following code, but it doesnt work:
elem = driver.find_element_by_tag_name('video').getAttribute('source')
And i also tried:
elem = driver.find_element_by_tag_name('video').getAttribute('src')
And i tried:
elem = driver.find_element_by_tag_name('video').find_element_by_tag_name('source').getAttribute('src')
Last but not least i changed the 'element' to 'elements', but it did not work. But none of it works. I made it with and without try/except, but when i did it without it doesn't give me a exception, it just exits, and when i did it with, it just goes to the catched exception. So how do i have to adress the source tag?
UPDATE: I changed it to: driver.find_element_by_tag_name('source').get_attribute("src") then it worked! Thanks to everyone, who helped me
Upvotes: 1
Views: 3304
Reputation: 21
Update right here: I changed it to:
driver.find_element_by_tag_name('source').get_attribute("src")
and then it worked. Thanks to everyone helping
Upvotes: 1