コード例 #1
0
def main(username):
    cfg = get_config()
    browser = load_browser(cfg)
    browser.get('https://www.okcupid.com/profile/' + username)

    elements = browser.find_elements_by_xpath('//*[@id="visit_button"]/button')
    like_button = elements[0]
    time.sleep(1)

    like_button.click()
コード例 #2
0
ファイル: profiles.py プロジェクト: NathanWailes/automate-okc
def main():
    cfg = get_config()
    browser = load_browser(cfg)

    with open('users_data.json', 'r') as f:
         users_data = json.load(f)
    usernames = users_data.keys()

    for username in usernames:
        if profile_has_been_scraped(users_data, username):
            continue
        else:
            update_users_data(browser, users_data, username)
    print("Done!")
コード例 #3
0
ファイル: message.py プロジェクト: NathanWailes/automate-okc
def main():
    cfg = get_config()
    browser = load_browser(cfg)
    #browser.maximize_window()

    browser.get('https://www.okcupid.com/profile/okcupid1865')
    elements = browser.find_elements_by_partial_link_text('Message')

    element = elements[1]
    element.click()

    message_box = browser.find_element_by_xpath("//textarea[starts-with(@id, 'message_')]")
    message_box.send_keys("Test message")

    send_button = browser.find_element_by_xpath("//*[@id='global_messaging_container']/div/form/button")
    send_button.click()
    print("Done!")
コード例 #4
0
def main():
    cfg = get_config()
    browser = load_browser(cfg)
    #browser.maximize_window()
    browser.get('https://www.okcupid.com/match')

    usernames = set()
    for age in range(18, 30):
        update_age(browser, age)
        time.sleep(pause)

        scroll_to_bottom_of_page(browser)

        new_usernames = get_all_usernames(browser)
        import pdb; pdb.set_trace()
        usernames = usernames | new_usernames

        scroll_to_top_of_page(browser)

    print("Done!")