Esempio n. 1
0
    def parse_video(self, soup: BeautifulSoup, url: URL):
        content = soup.find('div', {'class': 'player'})
        if content is not None:
            psp(content.prettify())
            script = content.find('script',
                                  text=lambda x: 'flashvars' in str(x))
            if script is not None:
                data = str(script.string).replace(' ', '').replace(
                    '\n', '').replace('\t', '')
                flashvars = quotes(data, 'flashvars={', '};').split(',')
                fv = dict()
                for flashvar in flashvars:
                    # print(flashvar)
                    split = flashvar.partition(':')
                    fv[split[0]] = split[2].strip("'\"")
                files = dict()
                for f in fv:
                    if fv[f].startswith('http://') and fv[f].endswith('.mp4/'):
                        file = fv[f]
                        label = fv.get(f + '_text', f)
                        files[label] = file

                print("=======================didn't work?")

                for key in sorted(files.keys(), reverse=True):
                    self.add_video(key, URL(files[key], referer=url))
Esempio n. 2
0
    def parse_thumbs_tags(self, soup: BeautifulSoup, url: URL):
        container=soup.find('section',{'class':'categories'})
        if container:
            for category in _iter(container.find_all('a',href=True)):
                psp(category.prettify())
                label=category.find('span',{'class':'highlight'})

                self.add_tag(label.string, URL(category.attrs['href'],base_url=url))
Esempio n. 3
0
 def parse_video(self, soup: BeautifulSoup, url: URL):
     video = soup.find('div', {'class': 'video'})
     if video is not None:
         psp(video.prettify())
         for i, source in enumerate(_iter(video.find_all('source'))):
             # self.add_video('source_' + str(i), URL(source.attrs['src'].replace('https', 'http'), base_url=url))
             self.add_video('source_' + str(i), URL(source.attrs['src'], base_url=url, referer=url.get()))
         self.set_default_video(-1)
Esempio n. 4
0
 def parse_video(self, soup: BeautifulSoup, url: URL):
     video = soup.find('div', {'class': 'video-player'})
     if video is not None:
         # psp(video.prettify())
         for source in _iter(video.find_all('source')):
             psp(source)
             self.add_video('DEFAULT', URL(source.attrs['src'],
                                           base_url=url))
         self.set_default_video(-1)
Esempio n. 5
0
 def parse_video(self, soup: BeautifulSoup, url: URL):
     video = soup.find('div', {'class': 'player'})
     if video is not None:
         psp(video.prettify())
         script = video.find(
             'script', text=lambda x: 'playerInstance.setup(' in str(x))
         if script is not None:
             data = str(script.string).replace(
                 ' ', '')  #.replace('\t', '').replace('\n', '')
             # psp(data)
             mp4 = quotes(data, "file:'", "'")
             self.add_video('DEFAULT', URL(mp4, base_url=url))
Esempio n. 6
0
    def parse_video_tags(self, soup: BeautifulSoup, url: URL):
        for actor_container in _iter(
                soup.find_all('div', {'id': 'video-actors'})):
            for href in _iter(actor_container.find_all('a')):
                psp(href)
                self.add_tag(str(href.attrs['title']),
                             URL(href.attrs['href'], base_url=url),
                             style={'color': 'blue'})

        for tag_container in _iter(soup.find_all('div', {'id': 'cat-list'})):
            for href in _iter(tag_container.find_all('a')):
                psp(href)
                self.add_tag(str(href.attrs['title']),
                             URL(href.attrs['href'], base_url=url))
Esempio n. 7
0
 def parse_video(self, soup: BeautifulSoup, url: URL):
     psp(soup)
     video = soup.find('div', {'class': 'watch'})
     if video:
         script = video.find('script',
                             text=lambda x: 'redtube_flv_player' in str(x))
         if script:
             data = str(script.string).replace(' ', '').replace('\\', '')
             psp(data)
             sources = quotes(data, 'mediaDefinition:[', ']').split('},{')
             for item in sources:
                 file = quotes(item, 'videoUrl":"', '"')
                 label = quotes(item, 'quality":"', '"')
                 if file:
                     self.add_video(label, URL(file, base_url=url))
Esempio n. 8
0
 def parse_video_tags(self, soup: BeautifulSoup, url: URL):
     info = soup.find('div', {'class': 'video-info'})
     if info:
         # psp(info.prettify())
         for xref in _iter(
                 info.find_all('a',
                               href=lambda x: not 'javascript' in str(x))):
             psp(xref)
             href = xref.attrs['href']
             if '/user/' in href:
                 self.add_tag(quotes(href, '/user/', '/'),
                              URL(href.replace('/user/', '/submitted/'),
                                  base_url=url),
                              style={'color': 'blue'})
             else:
                 self.add_tag(collect_string(xref), URL(href, base_url=url))
Esempio n. 9
0
    def parse_video_tags(self, soup: BeautifulSoup, url: URL):
        # info_box=soup.find('div',{'class':'content-container'})
        for info_box in _iter(
                soup.find_all('div', {'class': 'content-container'})):
            # psp(info_box.prettify())
            for href in _iter(info_box.find_all('a', href=True)):
                psp(href.prettify())
                label = collect_string(href)
                href_url = URL(href.attrs['href'], base_url=url)
                print(label, href_url)

                color = None

                if href_url.contain('/users/'):
                    color = 'blue'
                    href_url = URL(href_url.get() + '/videos/public/')

                if href_url.contain('/pornstar/'):
                    color = 'red'

                self.add_tag(label, href_url, style=dict(color=color))