Animatsiya.net - added VK video support
Fresh on the heels of fixing Dailymotion support last month by learning their new API, while the process was still fresh in my memory, this week I decided to add VK video support to Animatsiya.net. This means that custom subtitles can be placed over the top of any VK video (here's a recently-updated example). Many animated films are on VK.com even if they aren't anywhere else, so this should be very useful.
For example, a few weeks ago, one of the YouTube channels that upload old content from Soviet television (including animated films from Ekran studio, the USSR's second-biggest) decided to disallow embedding their videos in other sites such as Animatsiya. So dozens of Ekran animations suddenly stopped working.
At the same time, the other official "Soviet Television archive" YouTube channels (they maintain a number of them, for different "types" of content) continued to allow them, and kept uploading new films, including many of the ones that had just become inaccessible. Truly a case of the left hand not knowing what the right was doing.
I tried to replace all the broken links. However, not all of them have been re-uploaded to YouTube yet, while most of them have been on VK for a long time (sometimes for over a decade), so adding VK support was really important.
I didn't actually think it was possible at first, but it turns out they have a well-documented API for their video widget. The only issue was getting video thumbnails - I couldn't figure out a way to get them without using the video.get request, which required a user access token and access rights. In the end, I decided to use PHP's file_get_contents to scrape the thumbnail from the embed link of a VK video. Oddly, that seems to work faster than the official API methods I'm using to get the thumbnails from Dailymotion and Vimeo.
I'll probably try to add support for more video sites later. I made a spreadsheet comparing the various APIs/SDKs of the video sites out there, to see which ones have the features I'd need to add support. At minimum, I need a way to tell what time it is in the video that's being watched, so that the correct subtitle shows up at the correct time.
The following sites are currently supported:
YouTube, Dailymotion, Vimeo, VK
The following additional sites should be possible:
Facebook (if I'm allowed to create an app ID), Internet Archive, Rumble, PeerTube, RuTube, Odysee
Of those, I've seen Russian/Soviet animation actually being uploaded to Facebook (officially, believe it or not!), Internet Archive, Odysee and PeerTube (though federated PeerTube sites seem to be ephemeral and tend to be slow). Perhaps RuTube as well, although the only thing I found there was modern-Soyuzmultfilm's official channel with their new animated series, and the prolific content is (in my opinion) a discouraging dump of mediocrity and bad taste (I'm sure this is not what Yuriy Norshteyn was hoping for after his frequent calls over the decades to resurrect Soyuzmultfilm, that's all I'll say). Rumble seems to be user-friendly, but mainly focused on politically-controversial American content, without anyone uploading Russian/Soviet animation. Still, it would only take one channel (though the Russian government's banning of Rumble last month makes this less likely...).
Also, I have this idea that it may be possible to add external subtitle support for ANY video site that allows embedding (such as OK or bilibili or mover.uz) if I can get the user to click a "start subtitles" button at a time of their choosing. It would be the user's job to click "Start subtitles" at, say, 0:05 in the film. Not ideal, but probably not too awful, either!
The major issue with adding support for more sites is getting my head around the design. Some of the embedded videos from certain sites send out events that must be listened to (e.g. they send out "current time in video" every 1/4 second), while others will return the current time in the video if they are polled (I'd need to send a request to them asking what the current time is every 1/4 second, and wait for the reply). I want to write something that combines both to reduce repetition, but these are opposite approaches.
Unfortunately, working on the programming side has meant that the addition of new films has suffered. There's always a trade-off. :p
For example, a few weeks ago, one of the YouTube channels that upload old content from Soviet television (including animated films from Ekran studio, the USSR's second-biggest) decided to disallow embedding their videos in other sites such as Animatsiya. So dozens of Ekran animations suddenly stopped working.
At the same time, the other official "Soviet Television archive" YouTube channels (they maintain a number of them, for different "types" of content) continued to allow them, and kept uploading new films, including many of the ones that had just become inaccessible. Truly a case of the left hand not knowing what the right was doing.
I tried to replace all the broken links. However, not all of them have been re-uploaded to YouTube yet, while most of them have been on VK for a long time (sometimes for over a decade), so adding VK support was really important.
I didn't actually think it was possible at first, but it turns out they have a well-documented API for their video widget. The only issue was getting video thumbnails - I couldn't figure out a way to get them without using the video.get request, which required a user access token and access rights. In the end, I decided to use PHP's file_get_contents to scrape the thumbnail from the embed link of a VK video. Oddly, that seems to work faster than the official API methods I'm using to get the thumbnails from Dailymotion and Vimeo.
I'll probably try to add support for more video sites later. I made a spreadsheet comparing the various APIs/SDKs of the video sites out there, to see which ones have the features I'd need to add support. At minimum, I need a way to tell what time it is in the video that's being watched, so that the correct subtitle shows up at the correct time.
The following sites are currently supported:
YouTube, Dailymotion, Vimeo, VK
The following additional sites should be possible:
Facebook (if I'm allowed to create an app ID), Internet Archive, Rumble, PeerTube, RuTube, Odysee
Of those, I've seen Russian/Soviet animation actually being uploaded to Facebook (officially, believe it or not!), Internet Archive, Odysee and PeerTube (though federated PeerTube sites seem to be ephemeral and tend to be slow). Perhaps RuTube as well, although the only thing I found there was modern-Soyuzmultfilm's official channel with their new animated series, and the prolific content is (in my opinion) a discouraging dump of mediocrity and bad taste (I'm sure this is not what Yuriy Norshteyn was hoping for after his frequent calls over the decades to resurrect Soyuzmultfilm, that's all I'll say). Rumble seems to be user-friendly, but mainly focused on politically-controversial American content, without anyone uploading Russian/Soviet animation. Still, it would only take one channel (though the Russian government's banning of Rumble last month makes this less likely...).
Also, I have this idea that it may be possible to add external subtitle support for ANY video site that allows embedding (such as OK or bilibili or mover.uz) if I can get the user to click a "start subtitles" button at a time of their choosing. It would be the user's job to click "Start subtitles" at, say, 0:05 in the film. Not ideal, but probably not too awful, either!
The major issue with adding support for more sites is getting my head around the design. Some of the embedded videos from certain sites send out events that must be listened to (e.g. they send out "current time in video" every 1/4 second), while others will return the current time in the video if they are polled (I'd need to send a request to them asking what the current time is every 1/4 second, and wait for the reply). I want to write something that combines both to reduce repetition, but these are opposite approaches.
Unfortunately, working on the programming side has meant that the addition of new films has suffered. There's always a trade-off. :p