def addSignaturePayout(self, lineStrippedLower): 'Add signature payout if there is a devtome link.' lineStrippedLower = almoner.getWithoutLeadingStar(lineStrippedLower) if not lineStrippedLower.startswith('http'): return linkText = almoner.getInternetText(lineStrippedLower) if 'devtome.com' not in linkText: return if self.signaturePayout: return self.signaturePayout = True postString = '<td><b>Posts: </b></td>' postIndex = linkText.find(postString) if postIndex == -1: return postEndIndex = postIndex + len(postString) postNumberEndIndex = linkText.find('</td>', postEndIndex + 1) if postNumberEndIndex == -1: return postNumberString = linkText[postEndIndex : postNumberEndIndex].strip() if '>' in postNumberString: postNumberString = postNumberString[postNumberString.find('>') + 1 :] postNumber = int(postNumberString) if postNumber > 1000: self.payoutFifth += 2 print('Big signature payout: 2') else: self.payoutFifth += 1 print('Small signature payout: 1')
def addPostPayout(self, lineStrippedLower): 'Add post payout if there is a devtome link.' lineStrippedLower = almoner.getWithoutLeadingStar(lineStrippedLower) if not lineStrippedLower.startswith('http'): return if len(self.postPayoutSet) > 4: return linkText = almoner.getInternetText(lineStrippedLower) if '#' in lineStrippedLower: lineStrippedLower = lineStrippedLower[: lineStrippedLower.find('#')] if ';' in lineStrippedLower: lineStrippedLower = lineStrippedLower[: lineStrippedLower.find(';')] messageString = '<a class="message_number" style="vertical-align: middle;" href="' + lineStrippedLower if messageString not in linkText: return postBeginIndex = linkText.find(messageString) postBeginIndex = linkText.find('<div class="post"', postBeginIndex) if postBeginIndex == -1: return postEndIndex = linkText.find('<td valign="bottom"', postBeginIndex + 1) linkText = linkText[postBeginIndex : postEndIndex] if 'devtome.com' not in linkText: return if linkText in self.postPayoutSet: return self.postPayoutSet.add(linkText) self.postWords += len(linkText.split())
def addPostPayout(self, lineStrippedLower): 'Add post payout if there is a devtome link.' lineStrippedLower = almoner.getWithoutLeadingStar(lineStrippedLower) if not lineStrippedLower.startswith('http'): return if self.postPayout > 4: return linkText = almoner.getInternetText(lineStrippedLower) if '#' in lineStrippedLower: lineStrippedLower = lineStrippedLower[: lineStrippedLower.find('#')] if ';' in lineStrippedLower: lineStrippedLower = lineStrippedLower[: lineStrippedLower.find(';')] messageString = '<a class="message_number" style="vertical-align: middle;" href="' + lineStrippedLower if messageString not in linkText: return postBeginIndex = linkText.find(messageString) postBeginIndex = linkText.find('<div class="post"', postBeginIndex) if postBeginIndex == -1: return postEndIndex = linkText.find('<td valign="bottom"', postBeginIndex + 1) linkText = linkText[postBeginIndex : postEndIndex] if 'devtome.com' not in linkText: return self.postWords += len(linkText.split()) self.postPayout += 1
def addLinkPayout(self, lineStrippedLower): 'Add link payout if there is a devtome link.' lineStrippedLower = almoner.getWithoutLeadingStar(lineStrippedLower) if not lineStrippedLower.startswith('http'): return if len(self.domainPayoutSet) > 4: return originalLink = lineStrippedLower if lineStrippedLower.startswith('http://'): lineStrippedLower = lineStrippedLower[len('http://'):] elif lineStrippedLower.startswith('https://'): lineStrippedLower = lineStrippedLower[len('https://'):] if lineStrippedLower.startswith('www.'): lineStrippedLower = lineStrippedLower[len('www.'):] if lineStrippedLower.startswith('vps.'): lineStrippedLower = lineStrippedLower[len('vps.'):] if lineStrippedLower.endswith('/'): lineStrippedLower = lineStrippedLower[:-1] if lineStrippedLower in self.domainPayoutSet: return if '/' in lineStrippedLower: if self.subdomainPayout == 0: linkText = almoner.getInternetText(originalLink) if 'devtome.com' not in linkText: return self.subdomainPayout = 1 return linkText = '<a href="http://www.devtome.com/doku.php?id=earn_devcoins_by_writing"><img width="728" height="90"></a>' if lineStrippedLower != 'bitcoinaddict.com': linkText = almoner.getInternetText(originalLink) beginIndex = linkText.find('devtome.com') if beginIndex == -1: if '<title>Access denied' in linkText and 'used CloudFlare to restrict access</title>' in linkText: warningText = 'Could not open %s because access was denied by CloudFlare,' % lineStrippedLower warningText += ' so there will not be a payment for that link.' print(warningText) return self.domainPayoutSet.add(lineStrippedLower) self.payoutFifth += 2 printString = 'Domain name payout: 2, Address: %s' % lineStrippedLower while beginIndex != -1: endIndex = linkText.find('</a>', beginIndex) if endIndex == -1: print(printString) return linkString = linkText[beginIndex:endIndex] if '<img' in linkString: # if '<img' in linkString and '728' in linkString and '90' in linkString: extraPayoutFifth = getExtraPayoutFifth(lineStrippedLower) self.payoutFifth += extraPayoutFifth print('Banner payout: %s, Address: %s' % (extraPayoutFifth + 2, lineStrippedLower)) return beginIndex = linkText.find('devtome.com', endIndex) print(printString)
def addLinkPayout(self, lineStrippedLower): 'Add link payout if there is a devtome link.' lineStrippedLower = almoner.getWithoutLeadingStar(lineStrippedLower) if not lineStrippedLower.startswith('http'): return if len(self.domainPayoutSet) > 4: return originalLink = lineStrippedLower if lineStrippedLower.startswith('http://'): lineStrippedLower = lineStrippedLower[len('http://') :] elif lineStrippedLower.startswith('https://'): lineStrippedLower = lineStrippedLower[len('https://') :] if lineStrippedLower.startswith('www.'): lineStrippedLower = lineStrippedLower[len('www.') :] if lineStrippedLower.startswith('vps.'): lineStrippedLower = lineStrippedLower[len('vps.') :] if lineStrippedLower.endswith('/'): lineStrippedLower = lineStrippedLower[: -1] if lineStrippedLower in self.domainPayoutSet: return if '/' in lineStrippedLower: if self.subdomainPayout == 0: linkText = almoner.getInternetText(originalLink) if 'devtome.com' not in linkText: return self.subdomainPayout = 1 return linkText = '<a href="http://www.devtome.com/doku.php?id=earn_devcoins_by_writing"><img width="728" height="90"></a>' if lineStrippedLower != 'bitcoinaddict.com': linkText = almoner.getInternetText(originalLink) beginIndex = linkText.find('devtome.com') if beginIndex == -1: if '<title>Access denied' in linkText and 'used CloudFlare to restrict access</title>' in linkText: warningText = 'Could not open %s because access was denied by CloudFlare,' % lineStrippedLower warningText += ' so there will not be a payment for that link.' print(warningText) return self.domainPayoutSet.add(lineStrippedLower) self.payoutFifth += 2 printString = 'Domain name payout: 2, Address: %s' % lineStrippedLower while beginIndex != -1: endIndex = linkText.find('</a>', beginIndex) if endIndex == -1: print(printString) return linkString = linkText[beginIndex : endIndex] if '<img' in linkString: # if '<img' in linkString and '728' in linkString and '90' in linkString: extraPayoutFifth = getExtraPayoutFifth(lineStrippedLower) self.payoutFifth += extraPayoutFifth print('Banner payout: %s, Address: %s' % (extraPayoutFifth + 2, lineStrippedLower)) return beginIndex = linkText.find('devtome.com', endIndex) print(printString)
def addLinkPayout(self, lineStrippedLower): 'Add link payout if there is a devtome link.' lineStrippedLower = almoner.getWithoutLeadingStar(lineStrippedLower) if not lineStrippedLower.startswith('http'): return if self.domainPayout > 4: return originalLink = lineStrippedLower if lineStrippedLower.startswith('http://'): lineStrippedLower = lineStrippedLower[len('http://') :] elif lineStrippedLower.startswith('https://'): lineStrippedLower = lineStrippedLower[len('https://') :] if lineStrippedLower.startswith('www.'): lineStrippedLower = lineStrippedLower[len('www.') :] if lineStrippedLower.startswith('vps.'): lineStrippedLower = lineStrippedLower[len('vps.') :] if lineStrippedLower.endswith('/'): lineStrippedLower = lineStrippedLower[: -1] if '/' in lineStrippedLower: if self.subdomainPayout == 0: linkText = almoner.getInternetText(originalLink) if 'devtome.com' not in linkText: return self.subdomainPayout = 1 return linkText = '<a href="http://www.devtome.com/doku.php?id=earn_devcoins_by_writing"><img width="728" height="90"></a>' if lineStrippedLower != 'bitcoinaddict.com': linkText = almoner.getInternetText(originalLink) if 'devtome.com' not in linkText: return self.domainPayout += 1 self.payoutFifth += 2 printString = 'Domain name payout: 2, Address: %s' % lineStrippedLower beginIndex = linkText.find('devtome.com') while beginIndex != -1: endIndex = linkText.find('</a>', beginIndex) if endIndex == -1: print(printString) return linkString = linkText[beginIndex : endIndex] if '<img' in linkString: # if '<img' in linkString and '728' in linkString and '90' in linkString: extraPayoutFifth = getExtraPayoutFifth(lineStrippedLower) self.payoutFifth += extraPayoutFifth print('Banner payout: %s, Address: %s' % (extraPayoutFifth + 2, lineStrippedLower)) return beginIndex = linkText.find('devtome.com', endIndex) print(printString)
def addSignaturePayout(self, lineStrippedLower): 'Add signature payout if there is a devtome link.' if len(self.signaturePageSet) > 2: return lineStrippedLower = almoner.getWithoutLeadingStar(lineStrippedLower) if not lineStrippedLower.startswith('http'): return linkText = almoner.getInternetText(lineStrippedLower) if 'devtome.com' not in linkText: return if linkText in self.signaturePageSet: return payoutFifth = 0 if 'bitcointalk.org' in lineStrippedLower: payoutFifth = getPayoutFifthBitcoin(linkText) elif 'ppcointalk.org' in lineStrippedLower: payoutFifth = getPayoutFifthPpcoin(linkText) elif 'terracointalk.org' in lineStrippedLower: payoutFifth = getPayoutFifthTerracoin(linkText) if payoutFifth > 0: self.signaturePageSet.add(linkText) self.payoutFifth += payoutFifth