iOS 9's Picture in Picture with Youtube- powered by Pythonista
This script allows you to take youtube videos from the youtube app (which does not currently support picture-in-picture) and use them with picture-in-picture. This relies on the keepvid service to download the video. Here's how it works:
- The shortened URL is expanded to a full youtube URL.
- Pass it to the keepvid service by adding
http://www.keepvid.com/?url=in front of the url
- Use BeautifulSoup to find all the links on the page
- Make a list of all the links on the page that contain
googlevideo.com(some are to
redirect.googlevideo.com, and some are from another
- Open the first one in the browser
Now the video is in the browser with the default iOS video dialog, and can be used with picture-in-picture.
The script can be used from a youtube video in the browser through appex, in which the url will be displayed, or can be used from the app, in which case the video will be opened. It sucks that
webbrowser.opendoesn't work in the app extension.
Because of the use of appex and dialogs, it requires Pythonista 1.6, but could be easily modified not to.
Note- this took me all morning, even though it's not that long a script, I had never used BeautifulSoup before, so it took me a while. I had also planned to use savefrom.net, but couldn't find where the link was in the HTML for the page, so I switched to keepvid.com