示例#1
0
def exec_(config, edition, another_edition, script):
    USERNAME = config['USERNAME']
    PASSWORD = config['PASSWORD']
    SCRIPT_ID = config[edition]['SCRIPT_ID']

    LOGIN_URL = 'https://greasyfork.org/users/sign_in'
    EDIT_URL = 'https://greasyfork.org/scripts/{0}/versions/new'.format(SCRIPT_ID)

    summary = make_summary()
    another_edition = config[another_edition]
    another_edition = 'https://greasyfork.org/scripts/{0}-{1}'.format(another_edition['SCRIPT_ID'], another_edition['SCRIPT_NAME'])
    summary = summary.getResult(edition, another_edition)

    b = Browser()

    # login
    b.open(LOGIN_URL)
    b.select_form(nr=2)
    b['user[email]'] = USERNAME
    b['user[password]'] = PASSWORD
    b.submit()

    # edit source
    b.open(EDIT_URL)
    b.select_form(nr=1)
    b['script_version[additional_info][0][attribute_value]'] = summary.encode('utf-8')
    b['script_version[code]'] = script.encode('utf-8')
    b.submit(name='commit')
示例#2
0
def exec_(config, edition, another_edition, script):
    USERNAME = config['USERNAME']
    PASSWORD = config['PASSWORD']
    SCRIPT_ID = config[edition]['SCRIPT_ID']

    LOGIN_URL = 'https://monkeyguts.com/login/'
    EDIT_URL = 'https://monkeyguts.com/submit.php?id={0}'.format(SCRIPT_ID)

    summary = make_summary()
    another_edition = config[another_edition]
    another_edition = 'https://monkeyguts.com/code.php?id={0}'.format(another_edition['SCRIPT_ID'])
    summary = summary.getResult(edition, another_edition)

    b = Browser()

    # home page
    b.open(LOGIN_URL)
    b.select_form(name='login')
    b['username'] = USERNAME
    b['password'] = PASSWORD
    b.submit()

    # edit source
    b.open(EDIT_URL)
    b.select_form(nr=1)
    b['descr'] = summary.encode('utf-8')
    b['code'] = script.encode('utf-8')
    b.submit()
示例#3
0
def exec_(config, edition, another_edition, script):
    USERNAME = config['USERNAME']
    PASSWORD = config['PASSWORD']
    SCRIPT_ID = config[edition]['SCRIPT_ID']

    LOGIN_URL = 'https://monkeyguts.com/login/'
    EDIT_URL = 'https://monkeyguts.com/submit.php?id={0}'.format(SCRIPT_ID)

    summary = make_summary()
    another_edition = config[another_edition]
    another_edition = 'https://monkeyguts.com/code.php?id={0}'.format(
        another_edition['SCRIPT_ID'])
    summary = summary.getResult(edition, another_edition)

    b = Browser()

    # home page
    b.open(LOGIN_URL)
    b.select_form(name='login')
    b['username'] = USERNAME
    b['password'] = PASSWORD
    b.submit()

    # edit source
    b.open(EDIT_URL)
    b.select_form(nr=1)
    b['descr'] = summary.encode('utf-8')
    b['code'] = script.encode('utf-8')
    b.submit()
示例#4
0
def exec_(config, edition, another_edition, script):
    USERNAME = config['USERNAME']
    PASSWORD = config['PASSWORD']
    SCRIPT_ID = config[edition]['SCRIPT_ID']

    LOGIN_URL = 'https://greasyfork.org/users/sign_in'
    EDIT_URL = 'https://greasyfork.org/scripts/{0}/versions/new'.format(SCRIPT_ID)

    summary = make_summary()
    another_edition = config[another_edition]
    another_edition = 'https://greasyfork.org/scripts/{0}-{1}'.format(another_edition['SCRIPT_ID'], another_edition['SCRIPT_NAME'])
    summary = summary.getResult(edition, another_edition)

    b = Browser()

    # login
    b.open(LOGIN_URL)
    b.select_form(nr=3)
    b['user[email]'] = USERNAME
    b['user[password]'] = PASSWORD
    b.submit()

    # edit source
    b.open(EDIT_URL)
    b.select_form(nr=2)
    b['script_version[additional_info]'] = summary.encode('utf-8')
    b['script_version[code]'] = script.encode('utf-8')
    b.submit(name='commit')
示例#5
0
def exec_(config, edition, another_edition, script):
    USERNAME = config['USERNAME']
    NAMESPACE = config['NAMESPACE']
    SCRIPTNAME = config[edition]['SCRIPTNAME']
    GITHUB_USERNAME = config['GITHUB_USERNAME']
    GITHUB_PASSWORD = config['GITHUB_PASSWORD']

    HOME_URL = 'https://openuserjs.org'
    LOGIN_URL = '{0}/register'.format(HOME_URL)
    SCRIPT_URL = '{0}/user/add/scripts/new'.format(HOME_URL)
    ABOUT_URL = '{0}/script/{1}/{2}/edit'.format(HOME_URL, NAMESPACE,
                                                 SCRIPTNAME)
    URL_PARAM = '/scripts/{0}/{1}/{2}/source'.format(USERNAME, NAMESPACE,
                                                     SCRIPTNAME)

    summary = make_summary()
    another_edition = config[another_edition]
    another_edition = 'https://openuserjs.org/scripts/{0}/{1}'.format(
        USERNAME, another_edition['SCRIPTNAME'])
    summary = summary.getResult(edition, another_edition)

    b = mechanize.Browser()
    b.set_handle_robots(False)

    # home page
    b.open(LOGIN_URL)
    b.select_form(nr=0)
    b['username'] = USERNAME
    b.submit()

    # github login
    b.select_form(nr=1)
    b['login'] = GITHUB_USERNAME
    b['password'] = GITHUB_PASSWORD
    b.submit()

    # edit source
    # can not simply use mechanize because the form is generate by javascript
    jar = b._ua_handlers['_cookies'].cookiejar
    cookies = {c.name: c.value for c in jar}
    cookies = {
        'connect.sid': urllib.unquote(cookies['connect.sid']),
    }
    # somehow the SSL verification will fail
    r = requests.post(SCRIPT_URL,
                      cookies=cookies,
                      verify=False,
                      data={
                          'source': script.encode('utf-8'),
                          'url': URL_PARAM,
                      })

    # edit metadata
    b.open(ABOUT_URL)
    b.select_form(nr=0)
    b.find_control('groups').readonly = False
    b['about'] = summary.encode('utf-8')
    b['groups'] = 'ads'
    b.submit()
示例#6
0
def exec_(config, edition, another_edition, script):
    USERNAME = config['USERNAME']
    SCRIPTNAME = config[edition]['SCRIPTNAME']
    GITHUB_USERNAME = config['GITHUB_USERNAME']
    GITHUB_PASSWORD = config['GITHUB_PASSWORD']

    HOME_URL = 'https://openuserjs.org'
    LOGIN_URL = '{0}/register'.format(HOME_URL)
    SCRIPT_URL = '{0}/user/add/scripts/new'.format(HOME_URL)
    ABOUT_URL = '{0}/script/{1}/edit'.format(HOME_URL, SCRIPTNAME)
    URL_PARAM = '/scripts/{0}/{1}/source'.format(USERNAME, SCRIPTNAME)

    summary = make_summary()
    another_edition = config[another_edition]
    another_edition = 'https://openuserjs.org/scripts/{0}/{1}'.format(USERNAME, another_edition['SCRIPTNAME'])
    summary = summary.getResult(edition, another_edition)

    b = mechanize.Browser()
    b.set_handle_robots(False)

    # home page
    b.open(LOGIN_URL)
    b.select_form(nr=0)
    b['username'] = USERNAME
    b.submit()

    # github login
    b.select_form(nr=1)
    b['login'] = GITHUB_USERNAME
    b['password'] = GITHUB_PASSWORD
    b.submit()

    # edit source
    # can not simply use mechanize because the form is generate by javascript
    jar = b._ua_handlers['_cookies'].cookiejar
    cookies = {c.name: c.value for c in jar}
    cookies = {
        'connect.sid': urllib.unquote(cookies['connect.sid']),
    }
    # somehow the SSL verification will fail
    r = requests.post(SCRIPT_URL, cookies=cookies, verify=False, data={
        'source': script.encode('utf-8'),
        'url': URL_PARAM,
    })

    # edit metadata
    b.open(ABOUT_URL)
    b.select_form(nr=0)
    b.find_control('groups').readonly = False
    b['about'] = summary.encode('utf-8')
    b['groups'] = 'ads'
    b.submit()
示例#7
0
def exec_(config, edition, another_edition, script):
    USERNAME = config["USERNAME"]
    NAMESPACE = config["NAMESPACE"]
    SCRIPTNAME = config[edition]["SCRIPTNAME"]
    GITHUB_USERNAME = config["GITHUB_USERNAME"]
    GITHUB_PASSWORD = config["GITHUB_PASSWORD"]

    HOME_URL = "https://openuserjs.org"
    LOGIN_URL = "{0}/register".format(HOME_URL)
    SCRIPT_URL = "{0}/user/add/scripts/new".format(HOME_URL)
    ABOUT_URL = "{0}/script/{1}/{2}/edit".format(HOME_URL, NAMESPACE, SCRIPTNAME)
    URL_PARAM = "/scripts/{0}/{1}/{2}/source".format(USERNAME, NAMESPACE, SCRIPTNAME)

    summary = make_summary()
    another_edition = config[another_edition]
    another_edition = "https://openuserjs.org/scripts/{0}/{1}".format(USERNAME, another_edition["SCRIPTNAME"])
    summary = summary.getResult(edition, another_edition)

    b = mechanize.Browser()
    b.set_handle_robots(False)

    # home page
    b.open(LOGIN_URL)
    b.select_form(nr=0)
    b["username"] = USERNAME
    b.submit()

    # github login
    b.select_form(nr=1)
    b["login"] = GITHUB_USERNAME
    b["password"] = GITHUB_PASSWORD
    b.submit()

    # edit source
    # can not simply use mechanize because the form is generate by javascript
    jar = b._ua_handlers["_cookies"].cookiejar
    cookies = {c.name: c.value for c in jar}
    cookies = {"connect.sid": urllib.unquote(cookies["connect.sid"])}
    # somehow the SSL verification will fail
    r = requests.post(
        SCRIPT_URL, cookies=cookies, verify=False, data={"source": script.encode("utf-8"), "url": URL_PARAM}
    )

    # edit metadata
    b.open(ABOUT_URL)
    b.select_form(nr=0)
    b.find_control("groups").readonly = False
    b["about"] = summary.encode("utf-8")
    b["groups"] = "ads"
    b.submit()