Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. QWebview: Upload to Youtube returns error
Forum Updated to NodeBB v4.3 + New Features

QWebview: Upload to Youtube returns error

Scheduled Pinned Locked Moved Qt WebKit
2 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    huynhlv_54
    wrote on last edited by
    #1

    Here is my situation: I have created a QWebview, loaded a Youtube page, and logged in. I select upload option (http://www.youtube.com/my_videos_upload), and choose a video to upload. However, youtube always returns

    "The server has returned an invalid response. Please follow these steps and try uploading the file again."

    The code I'm using is:

    @import sys
    from PyQt4.QtCore import QUrl
    from PyQt4.QtGui import QApplication
    from PyQt4.QtWebKit import QWebView
    from PyQt4.QtNetwork import QNetworkAccessManager
    from PyQt4 import QtCore

    def fillForm(web, username, password):
    print "Filling in the form"
    doc = web.page().mainFrame().documentElement()

    print "Finding username tag"
    user = doc.findFirst("input[id=Email]")
    print "Finding passwd tag"
    passwd = doc.findFirst("input[id=Passwd]")    
    
    print "Setting information"
    user.evaluateJavaScript("this.value = '%s'" % username)
    passwd.evaluateJavaScript("this.value = '%s'" % password)    
    button = doc.findFirst("input[id=signIn]")
    button.evaluateJavaScript("this.click()")
    

    def doLogin(web, url, username, password):
    web.loadFinished.connect(lambda: fillForm(web, username, password))
    web.load(url)
    web.show()

    if name == "main":
    app = QApplication(sys.argv)

    nam = QNetworkAccessManager()
    web = QWebView()
    web.page().setNetworkAccessManager(nam)
    settings = web.settings()
    settings.setAttribute(QWebSettings.PluginsEnabled, True)
    
    url = QUrl(r"https://accounts.google.com/Login")
    username = "name"
    password = "pass"
    doLogin(web, url, username, password)
    app.exec_()@
    

    How can I solve that problem? Thanks.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      ProgOn
      wrote on last edited by
      #2

      Did you find the solution of this problem? Thanks.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved