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

Allow KnowledgableExtractorJS to parse out youtube watch from youtube… #135

Merged
merged 3 commits into from
Jan 15, 2016

Conversation

vonrosen
Copy link
Contributor

… javascript embed

@nlevitt
Copy link
Contributor

nlevitt commented Jan 13, 2016

Hey Hunter, looking at https://developers.google.com/youtube/iframe_api_reference?hl=en
their sample code has

    <!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
    <div id="player"></div>
    function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
          height: '390',
          width: '640',
          videoId: 'M7lc1UVf-VE',
          events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
          }
        });
      }

The first argument to YT.Player is an html tag id, which is arbitrary. Your regex only checks for 'ytplayer' though. Best to allow anything there.

Also, the regex should probably accept either single-quotes or double-quotes (right now it looks only for single-quotes).

Separately, it would be good to use addRelativeToBase(). Here's my suggested, untested code:

            String newUri = "https://www.youtube.com/watch?v=" + videoId;
            try {
                addRelativeToBase(curi,
                        ext.getExtractorParameters().getMaxOutlinks(), newUri,
                        LinkContext.INFERRED_MISC, Hop.INFERRED);
            } catch (URIException e) {
                // no way this should happen
                throw new IllegalStateException(newUri, e);
            }

nlevitt added a commit that referenced this pull request Jan 15, 2016
Allow KnowledgableExtractorJS to parse out youtube watch from youtube…
@nlevitt nlevitt merged commit 70c688a into internetarchive:master Jan 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants