chevron_left chevron_right
Login Register invert_colors photo_library


Stay updated and chat with others! - Join the Discord!
Thread Rating:
  • 0 Vote(s) - 0 Average


PyQt4 Doesn't play nice with adf.ly filter_list
Author
Message
PyQt4 Doesn't play nice with adf.ly #1
I'm trying to create an automated adf.ly clicker.

I found a part of PyQt4 that displays web pages, and allows for clicking hyperlinks and such, however, when going to an adf.ly link, it will not let me click the "skip ad" button, either normally or programaticlly (programatically I can't even seem to find it). It would be a big help if I could get some assistance on this.

My code:
Code:
#!/usr/bin/env python

import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
import time

app = QApplication(sys.argv)

class Test(QWidget):

    link = None
    web = None
    def __init__(self):
        super(Test, self).__init__()
        self.makeUI()

    def makeUI(self):
        button = QPushButton('Click',self)
        button.clicked.connect(self.clickit)
        button2 = QPushButton('Reload',self)
        button2.clicked.connect(self.reload)
        vbox = QVBoxLayout()
        
        self.web = QWebView()
        self.web.load(QUrl("http://adf.ly/cfi43"))
        
        vbox.addWidget(button2)
        vbox.addWidget(self.web)
        vbox.addWidget(button)

        self.setLayout(vbox)
        
        self.setGeometry(300,300,250,150)
        self.setWindowTitle('Click?')
        self.show()
        print('showing second screen')

    def clickit(self):
        doc = self.web.page().mainFrame().documentElement()
        doc.evaluateJavaScript('button = document.getElementById("skip_button");button.click()')
        print('Link clicked!')

    def reload(self):
        doc = self.web.page().mainFrame().documentElement()
        if(doc):
            print("Document found")
            print(doc)
            print(str(doc))
            print("LocalName:\n" + doc.localName())
            print("Classes:\n" + str(doc.classes()))
        self.link = doc.findFirst('a[id=skip_button]')
        if(self.link):
            print("link found!")
            print("LocalName:\n" + self.link.localName())
            print("Classes:\n" + str(self.link.classes()))
        self.web.show()
        

t = Test()
sys.exit(app.exec_())


P.S. I plan to release it to ya'll when it's done! Wink

P.S.S When I try to debug it with fiddler, fiddler doesn't even show that a request was made or a response received, but the web page is definitely loading up. What's up with that?
[Image: jWSyE88.png]

Reply

RE: PyQt4 Doesn't play nice with adf.ly #2
Probably the noob in me speaking, could be a script that restricts the usage and regex for only browser.

Reply

RE: PyQt4 Doesn't play nice with adf.ly #3
I thought that a QWebView would work like a normal web browser, but now that you mention it, it could be something in the request that throws it off, and I haven't quite figured out how to display the HTML I'm getting either...
[Image: jWSyE88.png]

Reply

RE: PyQt4 Doesn't play nice with adf.ly #4
(02-13-2014, 06:55 AM)3SidedSquare Wrote: I thought that a QWebView would work like a normal web browser, but now that you mention it, it could be something in the request that throws it off, and I haven't quite figured out how to display the HTML I'm getting either...

Yay, I was semi-helpful! Biggrin

Reply

RE: PyQt4 Doesn't play nice with adf.ly #5
Bu-dump
I figured part of it out, the user agent is nonexistent. I'll try changing it to the default chrome one and see if it helps.
http://screencast.com/t/Vg121M1uG
[Image: jWSyE88.png]

Reply






Users browsing this thread: 1 Guest(s)