def get_vids(url, category='none'):
	"""
	crawls a given url form chaturbate.com for videos
	and returns them as a list of dicts
	if a catergory is given it will be added to the dict

	a returnd dict looks like this
		 KEYS    VALUE
	[{ 'title': 'BF HAVE 8 INC BUT YOUR ',
		'link': 'https://chaturbate.com/nasty_girl_masturbate',
	'duration': '5 min',
	   'thumb': 'https://img-hw.com/videos/thumbs169/a3/ed/36/a3ed367bcb5a69a9ad.14.jpg',
		 'res': '720p',
	   'views': '13k',
	'uploader': 'hans',
	'category': 'Grany'}]
	"""

	hardcoded = 'https://chaturbate.com'
	video_info = []
	videos = []

	soup = helper.get_soup(url)

	videos = soup.find_all("li", class_="room_list_room")

	for info in videos:
		res = ''
		title = info.find("a", href=True).get('href')[1:-1]
		uploader = info.find("a", href=True).get('href')
		img = info.find("a", href=True).find('img').get('src')

		# views and time are only seperatot bei "," on the site
		duraview = info.find("li", class_="cams").text.split(",")
		views = duraview[1]

		# if duraview[0].find("h") != -1:  #
		#   h = float(duraview[0][:-4])
		#   duration = (h * 60) * 60

		# else:
		#   duration = duraview[0][:-5] * 60

		video_info.append(
			dict([
				('title', title),
				('link', hardcoded + uploader),
				('duration', 0),
				('thumb', img),
				('res', res),
				('views', views),
				('uploader', title),
				('category', category)
			]))
	return video_info
def get_shows(cat_id):
    url = 'http://watchwrestling24.net/'
    shows = []

    soup = helper.get_soup(url)

    div = soup.find_all(id="nav-menu-item-" + str(cat_id))
    show_div = div[0].ul.find_all("a")

    for li in show_div:
        shows.append(dict([('show', li.text), ('link', li.get('href'))]))

    return shows
Exemplo n.º 3
0
def get_vids(url, category='none'):
    '''crawls a given url form xvideos.com for videos
    and returns them as a list of dicts
    if a catergory is given it will be added to the dict
    '''
    hardcoded = 'https://xvideos.com'
    video_info = []
    videos = []
    soup = helper.get_soup(url)
    videos = soup.find_all("div", class_="thumb-block")
    page_lis = soup.find("div", class_="pagination").find_all('li')

    if page_lis[-1].a.text == "Next":
        page = page_lis[-2].a.text
    else:
        page = page_lis[-1].a.text

    for info in videos:
        inside = info.find("div", class_="thumb-inside")
        under = info.find("div", class_="thumb-under")
        title = under.find("a", href=True)
        img = inside.find("div", class_="thumb").find('img')
        res_tag = inside.find(class_="video-hd-mark")
        views = under.find("span", class_="sprfluous").nextSibling
        duration = helper.convert_duration(
            under.find("span", class_="duration").text)

        # sometimes there is no uploader
        try:
            uploader = under.find("span", class_="name").text
        except AttributeError:
            # Is no Uploader there, the views are difrent also
            views = under.find("span", class_="duration").nextSibling
            uploader = "Unknown"

        # sometimes there is no resolution tag
        try:
            res = res_tag.text
        except AttributeError:
            res = None

        video_info.append(
            dict([('title', title.get('title')),
                  ('link', hardcoded + title.get('href')),
                  ('duration', duration), ('thumb', img.get('data-src')),
                  ('res', res), ('views', views[1:]), ('uploader', uploader),
                  ('category', category), ('page', page)]))

    return video_info
def get_parts(url):
    soup = helper.get_soup(url)
    links = []

    div = soup.find_all("p", attrs={"class": "plinks"})

    for p in div:
        hoster = p.text
        content = p.next_sibling.find_all('a')

        for link in content:
            links.append(
                dict([('hoster', hoster), ('part', link.text),
                      ('link', link.get('href'))]))

    return links
def play_video(_handle, video):
	"""
	Play a video by the provided path.

	:param path: Fully-qualified video URL
	:type path: str
	"""

	soup = helper.get_soup(video)
	pattern = r"""https.*\.m3u8"""
	link = re.findall(pattern, str(soup))[0].replace(r'\u002D', '-')

	# Create a playable item with a path to play.
	play_item = xbmcgui.ListItem(path=link)

	# Pass the item to the Kodi player.
	xbmcplugin.setResolvedUrl(_handle, True, listitem=play_item)
Exemplo n.º 6
0
def play_video(_handle, video):
    """
    Play a video by the provided path.

    :param path: Fully-qualified video URL
    :type path: str
    """
    soup = helper.get_soup(video)

    div = soup.find("div", id="video-player-bg")
    script_tag = div.find_all("script")[4]

    tmp = script_tag.string.split("setVideoHLS('")[-1]
    m3u_link = tmp.split("')", 1)[0]

    # Create a playable item with a path to play.
    play_item = xbmcgui.ListItem(path=m3u_link)
    # Pass the item to the Kodi player.
    xbmcplugin.setResolvedUrl(_handle, True, listitem=play_item)
def get_cats():
	"""
	crawls the Catergorys from xvideos.com
	and returns them as a list of dicts

	[{'category': 'Pornos auf Deutsch', 'link': 'https://xvideos.com/lang/deutsch'},
	 {'category': '3d', 'link': 'https://xvideos.com/?k=3d&top'}]
	"""
	url = 'https://chaturbate.com'
	cats = []
	soup = helper.get_soup(url)
	ul = soup.find("ul", class_="sub-nav")

	for li in ul.find_all("li"):
		cats.append(
			dict([
				('category', li.text),
				('link', url + li.a.get('href'))
			]))

	return cats
def get_episodes(url):
    soup = helper.get_soup(url)
    episode_info = []
    episodes = soup.find_all("div", class_="picture-content")

    for info in episodes:
        res = ''
        views = ''
        uploader = ''
        title = info.a.get('title')
        img = info.a.img.get('src')

        episode_info.append(
            dict([
                ('title', title),
                ('link', info.a.get('href')),
                ('duration', 0),
                ('thumb', img),
                ('res', res),
                ('views', views),
                ('uploader', uploader),
            ]))
    return episode_info