-
-
Save chenhan1218/a3b5fdf53d0e63479a1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import mechanize | |
from colorama import init | |
from colorama import Fore, Back, Style | |
init() | |
def main(): | |
# Login | |
username = "======================" | |
password = "======================" | |
print(Fore.CYAN + "Try to login plurk account") | |
browser = mechanize.Browser() | |
browser.open("http://www.plurk.com/m/login") | |
browser.select_form(nr=1) | |
browser['username'] = username | |
browser['password'] = password | |
response = browser.submit() | |
print("") | |
while(1): | |
# Go to my plurks tab | |
browser.open("http://www.plurk.com/m/?mode=my") | |
print(Fore.MAGENTA + "Try to enter your pluk list") | |
# Get plurks count | |
links = browser.links(url_regex=r"^/m/u/{0}$".format(username)) | |
post_id = '' | |
for link in links: | |
for attr in link.attrs: | |
if attr[0] == 'id': | |
post_id = attr[1][1:] | |
break | |
break | |
if '' == post_id: | |
break | |
# Goto post detail page | |
browser.open("http://www.plurk.com/m/p/{0}".format(post_id)) | |
print(Fore.GREEN + "In post detail page : {0}".format(browser.geturl())) | |
print(Fore.GREEN + "Title : {0}".format(browser.title())) | |
# Goto delete page | |
browser.follow_link(url_regex=r'^/m/p/[0-9A-Za-z]+/d$') | |
print(Fore.GREEN + "In post delete page : {0}".format(browser.geturl())) | |
# Remove the plurk | |
browser.select_form(nr=1) | |
browser.submit() | |
print(Fore.GREEN + "In post removed page: {0}".format(browser.geturl())) | |
print("") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment