List all videos that are related to this one.
350808
def find_related(self, _connection=None, page_size=100, page_number=0):
        
        if self.id:
            return connection.ItemResultSet('find_related_videos',
                Video, _connection, page_size, page_number, None, None,
                video_id=self.id)
243420
def find_videos_by_playlist(self, playlist_id, page=1, count=20):
        
        url = 'https://openapi.youku.com/v2/playlists/videos.json'
        params = {
            'client_id': self.client_id,
            'playlist_id': playlist_id,
            'page': page,
            'count': count
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
194402
def find_next_video_in_playlist(self, playlist_id, cur_video_id):
        
        url = 'https://openapi.youku.com/v2/playlists/video/next.json'
        params = {
            'client_id': self.client_id,
            'playlist_id': playlist_id,
            'video_id': cur_video_id
        }
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
618877
def obtainInfo(self):

        

        try:
            info = self.ytdl.extract_info(self.yid, download=False)
        except youtube_dl.utils.DownloadError:
            raise ConnectionError

        if not self.preferences['stream']:
            self.url = (info['requested_formats'][0]['url'], info['requested_formats'][1]['url'])
            return True

        # else:
        for f in info['formats']:
            if 'filesize' not in f or not f['filesize']:
                f['filesize'] = float('inf') # next line won't fail, infinity, because unknown filesize is the least preferred

        # - for easy sorting - we'll get best quality and lowest filsize
        aud = {(-int(f['abr']),    f['filesize'], f['url']) for f in info['formats'] if f.get('abr') and not f.get('height')}
        vid = {(-int(f['height']), f['filesize'], f['url']) for f in info['formats'] if not f.get('abr') and f.get('height')}
        full= {(-int(f['height']), f['filesize'], f['url']) for f in info['formats'] if f.get('abr') and f.get('height')}

        try:
            _f = int( self.preferences.get('format') ) # if valid format is present, then choose closes value
            _k = lambda x: abs(x[0] + _f) # +, because x[0] is negative

        except (ValueError, TypeError):
            _k = lambda d: d

        if self.preferences['audio'] and self.preferences['video']: fm = sorted(full, key=_k)
        elif self.preferences['audio']: fm = sorted(aud, key=_k)
        elif self.preferences['video']: fm = sorted(vid, key=_k)

        filesize = 0
        i = -1

        try:
            while filesize == 0: # some videos are problematic, we will try to find format with non-zero filesize

                i += 1

                self.url = fm[i][2]
                if fm[i][1] == float('inf'):
                    filesize = int(self.r_session.head(self.url).headers['content-length'])
                else:
                    filesize = int(fm[i][1])

        except IndexError: # finding filesize failed for every format

            self.url = (info['requested_formats'][0]['url'], info['requested_formats'][1]['url'])
            self.preferences['stream'] = False # hopefully non-stream download will work

            return True

        self.filesize = filesize

        return True
98892
private function getVideos(): array {
        $videos = [];

        $topNode = $this->article()->getTopNode();

        if ($topNode instanceof Element && $topNode->parent() instanceof Element) {
            $nodes = $topNode->parent()->find('embed, object, iframe, video');

            foreach ($nodes as $node) {
                if ($node->hasAttribute('src')) {
                    $src = $node->attr('src');
                } else {
                    $src = $node->attr('data');
                }

                $match = array_reduce(self::$VIDEO_PROVIDERS, function($match, $domain) use ($src) {
                    $srcHost = (string)parse_url($src, PHP_URL_HOST);
                    $srcScheme = (string)parse_url($src, PHP_URL_SCHEME);

                    return $match || preg_match('@' . $domain . '$@i', $srcHost) && in_array($srcScheme, ['http', 'https']);
                });

                if (!$match) {
                    $srcPath = parse_url(strtolower($src), PHP_URL_PATH);
                    $srcExtension = pathinfo((string)$srcPath, PATHINFO_EXTENSION);

                    $match = in_array($srcExtension, self::$VIDEO_EXTENSIONS);
                }

                if ($match) {
                    $videos[] = $src;
                }
            }
        }

        return $videos;
    }
132727
public long video(List<String> openIds, String mediaId, String title, String desc) {
		return video(new Filter(false, null), openIds, mediaId, title, desc);
	}
747219
def add_video(self, shape_id):
        """"""
        video_xml = (
            '<p:video %s>\n'
            '  <p:cMediaNode vol="80000">\n'
            '    <p:cTn id="%d" fill="hold" display="0">\n'
            '      <p:stCondLst>\n'
            '        <p:cond delay="indefinite"/>\n'
            '      </p:stCondLst>\n'
            '    </p:cTn>\n'
            '    <p:tgtEl>\n'
            '      <p:spTgt spid="%d"/>\n'
            '    </p:tgtEl>\n'
            '  </p:cMediaNode>\n'
            '</p:video>\n' % (nsdecls('p'), self._next_cTn_id, shape_id)
        )
        video = parse_xml(video_xml)
        self.append(video)
1050202
public static function getVideoList() {
        if (self::$_video) {
            return self::$_video;
        }

        self::$_video = self::_getList('video');

        return self::$_video;
    }
1060155
@SuppressWarnings("unchecked")
	public List<Recording> listRecordings() throws OpenViduJavaClientException, OpenViduHttpException {
		HttpGet request = new HttpGet(OpenVidu.urlOpenViduServer + API_RECORDINGS);
		HttpResponse response;
		try {
			response = OpenVidu.httpClient.execute(request);
		} catch (IOException e) {
			throw new OpenViduJavaClientException(e.getMessage(), e.getCause());
		}

		try {
			int statusCode = response.getStatusLine().getStatusCode();
			if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
				List<Recording> recordings = new ArrayList<>();
				JSONObject json = httpResponseToJson(response);
				JSONArray array = (JSONArray) json.get("items");
				array.forEach(item -> {
					recordings.add(new Recording((JSONObject) item));
				});
				return recordings;
			} else {
				throw new OpenViduHttpException(statusCode);
			}
		} finally {
			EntityUtils.consumeQuietly(response.getEntity());
		}
	}
1357801
def find_videos_by_show(self, show_id, show_videotype=None,
                            show_videostage=None, orderby='videoseq-asc',
                            page=1, count=20):
        
        url = 'https://openapi.youku.com/v2/shows/videos.json'
        params = {
            'client_id': self.client_id,
            'show_id': show_id,
            'page': page,
            'count': count,
            'show_videotype': show_videotype,
            'show_videostage': show_videostage,
            'orderby': orderby
        }
        params = remove_none_value(params)
        r = requests.get(url, params=params)
        check_error(r)
        return r.json()
414935
public function getVideoList($id)
    {

        $this->setId($id);

        $list = array();
        $data = $this->getData($this->baseChannelUrl);

        if(!$data) {
            throw new \Exception("Video channel not found");
        }

        foreach ($data as $value) {
            $list[$value->id] = array(
                'id'              => $value->id,
                'title'           => $value->title,
                'description'     => $value->description,
                'thumbnail_small' => $value->thumbnail_small,
                'thumbnail_large' => $value->thumbnail_large,
                'duration'        => $value->duration,
                'upload_date'     => $value->upload_date,
                'like_count'      => isset($value->stats_number_of_likes) ? $value->stats_number_of_likes : 0,
                'view_count'      => isset($value->stats_number_of_plays) ? $value->stats_number_of_plays : 0,
                'comment_count'   => isset($value->stats_number_of_comments) ? $value->stats_number_of_comments : 0
            );
        }
        return $list;
    }
608768
public function getVideoDetail($id)
    {
        $this->setId($id);

        $data = $this->getData(str_replace('{key}', $this->key, $this->baseVideoUrl));

        if(isset($data->error))
        {
            throw new \Exception("Video not found");
        }

        return array(
            'id'              => $data->items[0]->id,
            'title'           => $data->items[0]->snippet->title,
            'description'     => $data->items[0]->snippet->description,
            'thumbnail_small' => $data->items[0]->snippet->thumbnails->default->url,
            'thumbnail_large' => $data->items[0]->snippet->thumbnails->high->url,
            'duration'        => static::_convert_time($data->items[0]->contentDetails->duration),
            'upload_date'     => $data->items[0]->snippet->publishedAt,
            'like_count'      => isset($data->items[0]->statistics->likeCount) ? $data->items[0]->statistics->likeCount : 0,
            'view_count'      => isset($data->items[0]->statistics->viewCount) ? $data->items[0]->statistics->viewCount : 0,
            'comment_count'   => isset($data->items[0]->statistics->commentCount) ? $data->items[0]->statistics->commentCount : 0,
            'uploader'        => $data->items[0]->snippet->channelTitle
        );
    }
321965
def files(self):
        """"""
        if self.topic.has_file:
            yield self.topic.file.file_url
        for reply in self.replies:
            if reply.has_file:
                yield reply.file.file_url
1142588
def do_video(self, args):
        """"""
        func = getattr(args, 'func', None)
        if func is not None:
            # Call whatever subcommand function was selected
            func(self, args)
        else:
            # No subcommand was provided, so call help
            self.do_help('video')
1150385
def _to_dict(self):
        
        data = {
            'name': self.name,
            'referenceId': self.reference_id,
            'shortDescription': self.short_description,
            'playlistType': self.type,
            'id': self.id}
        if self.videos:
            for video in self.videos:
                if video.id not in self.video_ids:
                    self.video_ids.append(video.id)
        if self.video_ids:
            data['videoIds'] = self.video_ids
        [data.pop(key) for key in data.keys() if data[key] == None]
        return data
210631
def all(self):
        
        datasets = []

        query = text("""
            SELECT vid
            FROM dataset_index;""")

        for result in self.execute(query):
            res = DatasetSearchResult()
            res.vid = result[0]
            res.b_score = 1
            datasets.append(res)
        return datasets
1316121
def _remember_videos(page, fetches, stitch_ups=None):
    '''
    
    '''
    if not 'videos' in page:
        page.videos = []
    for fetch in fetches or []:
        content_type = fetch['response_headers'].get_content_type()
        if (content_type.startswith('video/')
                # skip manifests of DASH segmented video -
                # see https://github.com/internetarchive/brozzler/pull/70
                and content_type != 'video/vnd.mpeg.dash.mpd'
                and fetch['method'] == 'GET'
                and fetch['response_code'] in (200, 206)):
            video = {
                'blame': 'youtube-dl',
                'url': fetch['url'],
                'response_code': fetch['response_code'],
                'content-type': content_type,
            }
            if 'content-length' in fetch['response_headers']:
                video['content-length'] = int(
                        fetch['response_headers']['content-length'])
            if 'content-range' in fetch['response_headers']:
                video['content-range'] = fetch[
                        'response_headers']['content-range']
            logging.debug('embedded video %s', video)
            page.videos.append(video)
    for stitch_up in stitch_ups or []:
        if stitch_up['content-type'].startswith('video/'):
            video = {
                'blame': 'youtube-dl',
                'url': stitch_up['url'],
                'response_code': stitch_up['response_code'],
                'content-type': stitch_up['content-type'],
                'content-length': stitch_up['content-length'],
            }
            logging.debug('embedded video %s', video)
            page.videos.append(video)