コード例 #1
0
 def getNumbers(self, comment):
     numbers = re.findall(r'(?<=(?<!\>)\!)\d{5,8}(?=\!(?!\<))', comment)
     try:
         numbers = [int(number) for number in numbers]
     except ValueError:
         numbers = []
     numbers = commentpy.removeDuplicates(numbers)
     return [{'number': number, 'type': 'hitomila'} for number in numbers]
コード例 #2
0
def getNumbers(comment):
    numbers = re.findall(r'(?<=\))\d{5}(?=\()', comment)
    try:
        numbers = [int(number) for number in numbers]
    except ValueError:
        numbers = []
    numbers = commentpy.removeDuplicates(numbers)
    return numbers
コード例 #3
0
 def getNumbers(self, comment):
     numbers = re.findall(r'(?<=\()\d{5,6}(?=\))', comment)
     try:
         numbers = [int(number) for number in numbers]
     except ValueError:
         numbers = []
     numbers = commentpy.removeDuplicates(numbers)
     return [{'number': number, 'type': 'nhentai'} for number in numbers]
コード例 #4
0
def scanURL(comment):
    nhentaiNumbers = []
    nhentaiLinks = re.findall(r'https?:\/\/(?:www.)?nhentai.net\/g\/\d{1,6}',
                              comment.lower())
    print(nhentaiLinks)
    try:
        nhentaiNumbers = [
            re.search(r'\d+', link).group(0) for link in nhentaiLinks
        ]
    except AttributeError:
        print("No nHentai links")
    try:
        nhentaiNumbers = [int(number) for number in nhentaiNumbers]
    except ValueError:
        nhentaiNumbers = []
    nhentaiNumbers = commentpy.removeDuplicates(nhentaiNumbers)
    return nhentaiNumbers
コード例 #5
0
 def scanURL(self, comment):
     tsuminoNumbers = []
     # use lowercase comment because tsumino has an inconsistent url scheme 
     commentLower = comment.lower()
     tsuminoLinks = re.findall(r'https?:\/\/(?:www.)?tsumino.com\/book\/info\/\d{1,5}', commentLower)
     tsuminoLinks += re.findall(r'https?:\/\/(?:www.)?tsumino.com\/read\/view\/\d{1,5}', commentLower)
     tsuminoLinks += re.findall(r'https?:\/\/(?:www.)?tsumino.com\/entry\/\d{1,5}', commentLower)
     try:
         tsuminoNumbers = [re.search(r'\d+', link).group(0) for link in tsuminoLinks]
     except AttributeError:
         pass
     try:
         tsuminoNumbers = [int(number) for number in tsuminoNumbers]
     except ValueError:
         tsuminoNumbers = []
     tsuminoNumbers = commentpy.removeDuplicates(tsuminoNumbers)
     return [{'number': number, 'type': 'tsumino'} for number in tsuminoNumbers]
     
コード例 #6
0
 def scanURL(self, comment):
     nhentaiNumbers = []
     nhentaiLinks = re.findall(
         r'https?:\/\/(?:www.)?nhentai.net\/g\/\d{1,6}', comment.lower())
     try:
         nhentaiNumbers = [
             re.search(r'\d+', link).group(0) for link in nhentaiLinks
         ]
     except AttributeError:
         pass
     try:
         nhentaiNumbers = [int(number) for number in nhentaiNumbers]
     except ValueError:
         nhentaiNumbers = []
     nhentaiNumbers = commentpy.removeDuplicates(nhentaiNumbers)
     return [{
         'number': number,
         'type': 'nhentai'
     } for number in nhentaiNumbers]
コード例 #7
0
 def scanURL(self, comment):
     hitomilaNumbers = []
     # https://hitomi.la/galleries/1367588.html
     # https://hitomi.la/reader/1367588.html#2
     hitomilaLinks = re.findall(
         r'https?:\/\/(?:www.)?hitomi.la\/galleries\/\d{1,8}', comment)
     hitomilaLinks += re.findall(
         r'https?:\/\/(?:www.)?hitomi.la\/reader\/\d{1,8}', comment)
     try:
         hitomilaNumbers = [
             re.search(r'\d+', link).group(0) for link in hitomilaLinks
         ]
     except AttributeError:
         print("No Tsumino links")
     try:
         hitomilaNumbers = [int(number) for number in hitomilaNumbers]
     except ValueError:
         hitomilaNumbers = []
     hitomilaNumbers = commentpy.removeDuplicates(hitomilaNumbers)
     return [{
         'number': number,
         'type': 'hitomila'
     } for number in hitomilaNumbers]