Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YouTube sprout will stop working in May #640

Closed
gerundt opened this issue Apr 21, 2015 · 8 comments
Closed

YouTube sprout will stop working in May #640

gerundt opened this issue Apr 21, 2015 · 8 comments

Comments

@gerundt
Copy link
Contributor

gerundt commented Apr 21, 2015

I got today a warning video in a YouTube sprout, that the old API will drop:

In early May, Data API v2 video calls will start returning only the warning video introduced on April 20. Users will not be able to view other videos on apps that use the v2 API video calls. See youtube.com/devicesupport for affected devices.

By late May, v2 API calls except for comments and captions will receive 410 Gone HTTP responses.

http://youtube-eng.blogspot.de/2015/04/bye-bye-youtube-data-api-v2.html

@ochristi
Copy link
Contributor

Hi, noticed this too. I got a working fix, but would need a solution to avoid duplicates.
The old spout used to insert uid for items in the form of "http://gdata.youtube.com/feeds/api/videos/{videoid}", now I would get uid in the form of "yt:video:{videoid}". Now it would insert all loaded items again, since the uid differ.
We could solve it by updating all old entries to follow the new format, but since it is a change in the spout and we do not have "versions" for that, I have the following idea:

  • apply the compatibly fix to a new spout called youtubev3
  • alter the original spout in a way, which will update the uids of all items of a source with the current spout path spouts\youtube\youtube
  • this will update the path to spouts\youtube\youtubev3, but perform all other things as expected, e.g. by having youtube extend youtubev3
  • next time the update will trigger the new path, which does not have to update the items again

Any suggestions, questions? (I hope I have my terminology clear.)

@PhrozenByte
Copy link
Contributor

A straightforward solution would be something like this (daos/mysql/Database.php), solutions for pgsql and sqlite would be quiet similar. Spouts aren't managed separately, they are updated with a new selfoss release; whether the source code changed or the database scheme.

if(strnatcmp($version, "7") < 0){
    \F3::get('db')->exec('
        UPDATE items
        SET uid = REPLACE(uid, 'http://gdata.youtube.com/feeds/api/videos/', 'yt:video:')
        WHERE source IN (SELECT id FROM sources WHERE spout = 'spouts\\youtube\\youtube')
    ');
}

@niol
Copy link
Collaborator

niol commented May 20, 2015

Maybe you can abstract the uid compare function: make it a simple comparison for all spouts, and make it compare both forms of the uid for the youtube spout.

If you can avoid a databse schema version, it's better, because it's 3 times the work and the tests.

@ochristi
Copy link
Contributor

I think I will go with the compare thingy, just stripping the stuff before in the process and leaving the plain video id.

$id = str_replace(
    array('http://gdata.youtube.com/feeds/api/videos/', 'yt:video:'),
    "",
    $id
);

Edit: Another thing, which came to my mind, how about supporting channels without a "username", but this is probably subject of a new issue.

@ochristi
Copy link
Contributor

Well, this attempt to customize the getId() function of the youtube spout does not work, as it is only compared to the already present uid of items in the DB, which are all starting with http://gdata.youtube.com/feeds/api/videos/.
I do not want to touch the following part of helpers/ContentLoader.php and bloat the comparison which will probably only yield many complications.

if (isset($itemsFound[$item->getId()])) {
    continue;
}

The least intrusive approach would be to just replace yt:video: with the old prefix, but I am not too happy with such a solution.

@gerundt
Copy link
Contributor Author

gerundt commented Jun 10, 2015

@ochristi
Copy link
Contributor

That is what I changed the spout to. I have not yet managed to create a pull request. I also wanted to add an option for channels with id only.

@viniciushsantana
Copy link

Any progress on updating the spout? Or migrating to RSS is the only way?

jtojnar added a commit to jtojnar/selfoss that referenced this issue Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants