As we all know, there are infinite sites, especially bbs, have a sign-in mechanism to keep users. Usually, there are some resources, mostly downloadable at a cost of some points by consecutive signs. Hence, many will face a problem that the points are insufficient from time to time, because few people can keep active on those sites frequently. Therefore, it is natural to write a script to sign-in automatically and daily through crontab features. I respect all the sites as well as their benefits, and I understand maintain a website need dedication and money, so this passage is just for learning and fun, instead of a battlecry towards them.

Python is a popular language in recent years (See TIOBE Index) with fabulous features. Almost every Linux distribution preloaded Python. A convulted problem is there are Python2 and Python3 parralleling and not comaptible with each other. Apparently, Python3 is the latest version substantially, however, Python2 is supported until 2020 according to Python developers. As a researcher, learning new things is an essential ability. Hence, I am trying to get used to Python3. Thanks to 2to3 and the documents, I've translated my original Python2 code to Python3, so in this passage all codes are in Python3!

alt

Apparently, all we need to do is to click, or request the sign-in button. However, to achieve this, we need to log in and save cookies first.

We need import urllib, urllib2, cookielib and re.

Like this post? Share on: TwitterFacebookEmail


Published

Category

Miscellaneous

Stay in Touch

Get Monthly Updates