35 lines
929 B
Python
35 lines
929 B
Python
|
#!/usr/bin/env python3
|
||
|
# -*- encoding: utf-8 -*-
|
||
|
|
||
|
from ..downloadedData import DownloadedData
|
||
|
from ... import simpleDownloader
|
||
|
|
||
|
def works_on(domain):
|
||
|
return domain=='direct_link'
|
||
|
|
||
|
class DirectLink(object):
|
||
|
def recognizes(self, link):
|
||
|
if (
|
||
|
link.startswith('http://u18chan.com/')
|
||
|
or
|
||
|
link.startswith('https://u18chan.com/')
|
||
|
or
|
||
|
link.startswith('http://dl.dropboxusercontent.com')
|
||
|
or
|
||
|
link.startswith('https://dl.dropboxusercontent.com')
|
||
|
):
|
||
|
return False
|
||
|
return True
|
||
|
|
||
|
def download(self, link):
|
||
|
dd = DownloadedData()
|
||
|
simpleDownloader.cleanCookies()
|
||
|
bts = simpleDownloader.getUrlBytes(link)
|
||
|
simpleDownloader.cleanCookies()
|
||
|
if bts is not None:
|
||
|
dd.put(link,bts)
|
||
|
return dd
|
||
|
|
||
|
def get_class():
|
||
|
return DirectLink
|