Commit 8c673fe3 authored by lixiaofang's avatar lixiaofang

add

parent 6e5b6d60
...@@ -3,7 +3,12 @@ ...@@ -3,7 +3,12 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="fd1f0b61-1139-44e5-87e7-f8b86ff52376" name="Default Changelist" comment=""> <list default="true" id="fd1f0b61-1139-44e5-87e7-f8b86ff52376" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/auto_star_topic.py" beforeDir="false" afterPath="$PROJECT_DIR$/auto_star_topic.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/auto_click.py" beforeDir="false" afterPath="$PROJECT_DIR$/auto_click.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/auto_click_n.py" beforeDir="false" afterPath="$PROJECT_DIR$/auto_click_n.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/auto_commnet.py" beforeDir="false" afterPath="$PROJECT_DIR$/auto_commnet.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/auto_every_day.py" beforeDir="false" afterPath="$PROJECT_DIR$/auto_every_day.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/auto_follow.py" beforeDir="false" afterPath="$PROJECT_DIR$/auto_follow.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/auto_follow_majia.py" beforeDir="false" afterPath="$PROJECT_DIR$/auto_follow_majia.py" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
...@@ -28,7 +33,7 @@ ...@@ -28,7 +33,7 @@
<entry key="batch_user_gen" value="4" /> <entry key="batch_user_gen" value="4" />
<entry key="comment" value="2" /> <entry key="comment" value="2" />
<entry key="guanshui" value="3" /> <entry key="guanshui" value="3" />
<entry key="py" value="216" /> <entry key="py" value="220" />
<entry key="txt" value="8" /> <entry key="txt" value="8" />
<entry key="xuqiu" value="2" /> <entry key="xuqiu" value="2" />
</counts> </counts>
...@@ -36,7 +41,7 @@ ...@@ -36,7 +41,7 @@
<usages-collector id="statistics.file.types.open"> <usages-collector id="statistics.file.types.open">
<counts> <counts>
<entry key="PLAIN_TEXT" value="19" /> <entry key="PLAIN_TEXT" value="19" />
<entry key="Python" value="216" /> <entry key="Python" value="220" />
</counts> </counts>
</usages-collector> </usages-collector>
<usages-collector id="statistics.file.extensions.edit"> <usages-collector id="statistics.file.extensions.edit">
...@@ -44,14 +49,14 @@ ...@@ -44,14 +49,14 @@
<entry key="comment" value="59" /> <entry key="comment" value="59" />
<entry key="dummy" value="6" /> <entry key="dummy" value="6" />
<entry key="guanshui" value="2" /> <entry key="guanshui" value="2" />
<entry key="py" value="5193" /> <entry key="py" value="5354" />
<entry key="xuqiu" value="223" /> <entry key="xuqiu" value="223" />
</counts> </counts>
</usages-collector> </usages-collector>
<usages-collector id="statistics.file.types.edit"> <usages-collector id="statistics.file.types.edit">
<counts> <counts>
<entry key="PLAIN_TEXT" value="290" /> <entry key="PLAIN_TEXT" value="290" />
<entry key="Python" value="5193" /> <entry key="Python" value="5354" />
</counts> </counts>
</usages-collector> </usages-collector>
</session> </session>
...@@ -122,8 +127,8 @@ ...@@ -122,8 +127,8 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/auto_click.py"> <entry file="file://$PROJECT_DIR$/auto_click.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="251"> <state relative-caret-position="347">
<caret line="50" column="30" lean-forward="true" selection-start-line="50" selection-start-column="30" selection-end-line="50" selection-end-column="30" /> <caret line="32" column="16" selection-start-line="32" selection-start-column="16" selection-end-line="32" selection-end-column="16" />
<folding> <folding>
<element signature="e#0#11#0" expanded="true" /> <element signature="e#0#11#0" expanded="true" />
</folding> </folding>
...@@ -131,11 +136,11 @@ ...@@ -131,11 +136,11 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/auto_star_topic.py"> <entry file="file://$PROJECT_DIR$/auto_star_topic.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195"> <state relative-caret-position="145">
<caret line="21" column="24" lean-forward="true" selection-start-line="21" selection-start-column="24" selection-end-line="21" selection-end-column="24" /> <caret line="20" column="60" selection-start-line="20" selection-start-column="60" selection-end-line="20" selection-end-column="60" />
<folding> <folding>
<element signature="e#0#15#0" expanded="true" /> <element signature="e#0#15#0" expanded="true" />
</folding> </folding>
...@@ -146,8 +151,8 @@ ...@@ -146,8 +151,8 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/auto_click_n.py"> <entry file="file://$PROJECT_DIR$/auto_click_n.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1050"> <state relative-caret-position="525">
<caret line="70" column="16" selection-start-line="70" selection-start-column="16" selection-end-line="70" selection-end-column="16" /> <caret line="35" column="17" selection-start-line="35" selection-start-column="17" selection-end-line="35" selection-end-column="17" />
<folding> <folding>
<element signature="e#0#15#0" expanded="true" /> <element signature="e#0#15#0" expanded="true" />
</folding> </folding>
...@@ -176,8 +181,50 @@ ...@@ -176,8 +181,50 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/auto_commnet.py"> <entry file="file://$PROJECT_DIR$/auto_commnet.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252"> <state relative-caret-position="396">
<caret line="52" column="22" lean-forward="true" selection-start-line="52" selection-start-column="22" selection-end-line="52" selection-end-column="22" /> <caret line="38" column="16" selection-start-line="38" selection-start-column="16" selection-end-line="38" selection-end-column="16" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/auto_every_day.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="417">
<caret line="50" column="16" selection-start-line="50" selection-start-column="16" selection-end-line="50" selection-end-column="16" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/auto_follow.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="34" column="16" selection-start-line="34" selection-start-column="16" selection-end-line="34" selection-end-column="16" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/auto_follow_new.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-3">
<caret line="51" column="22" lean-forward="true" selection-start-line="51" selection-start-column="22" selection-end-line="51" selection-end-column="22" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/auto_follow_majia.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1155">
<caret line="77" column="31" lean-forward="true" selection-start-line="77" selection-start-column="31" selection-end-line="77" selection-end-column="31" />
<folding> <folding>
<element signature="e#0#15#0" expanded="true" /> <element signature="e#0#15#0" expanded="true" />
</folding> </folding>
...@@ -247,15 +294,11 @@ ...@@ -247,15 +294,11 @@
<option value="$PROJECT_DIR$/tasks/auto_at_once.py" /> <option value="$PROJECT_DIR$/tasks/auto_at_once.py" />
<option value="$PROJECT_DIR$/_celery.py" /> <option value="$PROJECT_DIR$/_celery.py" />
<option value="$PROJECT_DIR$/comment.txt" /> <option value="$PROJECT_DIR$/comment.txt" />
<option value="$PROJECT_DIR$/auto_follow_majia.py" />
<option value="$PROJECT_DIR$/auto_at_once.py" /> <option value="$PROJECT_DIR$/auto_at_once.py" />
<option value="$PROJECT_DIR$/auto_follow.py" />
<option value="$PROJECT_DIR$/auto_follow_new.py" /> <option value="$PROJECT_DIR$/auto_follow_new.py" />
<option value="$PROJECT_DIR$/auto_lunch_app.py" /> <option value="$PROJECT_DIR$/auto_lunch_app.py" />
<option value="$PROJECT_DIR$/auto_follow_one.py" /> <option value="$PROJECT_DIR$/auto_follow_one.py" />
<option value="$PROJECT_DIR$/auto_urge_three.py" /> <option value="$PROJECT_DIR$/auto_urge_three.py" />
<option value="$PROJECT_DIR$/auto_every_day.py" />
<option value="$PROJECT_DIR$/auto_click.py" />
<option value="$PROJECT_DIR$/auto_user_id.py" /> <option value="$PROJECT_DIR$/auto_user_id.py" />
<option value="$PROJECT_DIR$/auto_request.py" /> <option value="$PROJECT_DIR$/auto_request.py" />
<option value="$PROJECT_DIR$/offline_comment.py" /> <option value="$PROJECT_DIR$/offline_comment.py" />
...@@ -263,9 +306,13 @@ ...@@ -263,9 +306,13 @@
<option value="$PROJECT_DIR$/com.py" /> <option value="$PROJECT_DIR$/com.py" />
<option value="$PROJECT_DIR$/auto_star_urge.py" /> <option value="$PROJECT_DIR$/auto_star_urge.py" />
<option value="$PROJECT_DIR$/auto_urge.py" /> <option value="$PROJECT_DIR$/auto_urge.py" />
<option value="$PROJECT_DIR$/auto_commnet.py" />
<option value="$PROJECT_DIR$/auto_click_n.py" />
<option value="$PROJECT_DIR$/auto_star_topic.py" /> <option value="$PROJECT_DIR$/auto_star_topic.py" />
<option value="$PROJECT_DIR$/auto_follow.py" />
<option value="$PROJECT_DIR$/auto_click.py" />
<option value="$PROJECT_DIR$/auto_click_n.py" />
<option value="$PROJECT_DIR$/auto_commnet.py" />
<option value="$PROJECT_DIR$/auto_every_day.py" />
<option value="$PROJECT_DIR$/auto_follow_majia.py" />
</list> </list>
</option> </option>
</component> </component>
...@@ -483,10 +530,11 @@ ...@@ -483,10 +530,11 @@
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="0" y="23" width="1280" height="724" extended-state="0" /> <frame x="0" y="23" width="1280" height="724" extended-state="0" />
<editor active="true" />
<layout> <layout>
<window_info id="Structure" order="0" sideWeight="0.21188119" side_tool="true" weight="0.19112115" /> <window_info id="Structure" order="0" sideWeight="0.21188119" side_tool="true" weight="0.19112115" />
<window_info id="Favorites" order="1" side_tool="true" /> <window_info id="Favorites" order="1" side_tool="true" />
<window_info content_ui="combo" id="Project" order="2" sideWeight="0.7872763" visible="true" weight="0.20889595" /> <window_info active="true" content_ui="combo" id="Project" order="2" sideWeight="0.7872763" visible="true" weight="0.20889595" />
<window_info id="DB Browser" order="3" /> <window_info id="DB Browser" order="3" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.3284974" /> <window_info anchor="bottom" id="Find" order="1" weight="0.3284974" />
...@@ -496,7 +544,7 @@ ...@@ -496,7 +544,7 @@
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" /> <window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Version Control" order="7" show_stripe_button="false" /> <window_info anchor="bottom" id="Version Control" order="7" show_stripe_button="false" />
<window_info active="true" anchor="bottom" id="Terminal" order="8" visible="true" weight="0.32840723" /> <window_info anchor="bottom" id="Terminal" order="8" visible="true" weight="0.0" />
<window_info anchor="bottom" id="Event Log" order="9" side_tool="true" /> <window_info anchor="bottom" id="Event Log" order="9" side_tool="true" />
<window_info anchor="bottom" id="Python Console" order="10" /> <window_info anchor="bottom" id="Python Console" order="10" />
<window_info anchor="bottom" id="DB Execution Console" order="11" /> <window_info anchor="bottom" id="DB Execution Console" order="11" />
...@@ -660,37 +708,6 @@ ...@@ -660,37 +708,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/auto_every_day.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="391">
<caret line="37" column="97" selection-start-line="37" selection-start-column="97" selection-end-line="37" selection-end-column="97" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/auto_follow.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="480">
<caret line="68" selection-start-line="68" selection-end-line="68" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/auto_follow_majia.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="13" selection-start-line="7" selection-end-line="8" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/auto_follow_new.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="389">
<caret line="121" column="35" selection-start-line="121" selection-start-column="35" selection-end-line="121" selection-end-column="35" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/auto_follow_one.py"> <entry file="file://$PROJECT_DIR$/auto_follow_one.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="480"> <state relative-caret-position="480">
...@@ -779,16 +796,6 @@ ...@@ -779,16 +796,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/auto_commnet.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252">
<caret line="52" column="22" lean-forward="true" selection-start-line="52" selection-start-column="22" selection-end-line="52" selection-end-column="22" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/auto_star_urge.py"> <entry file="file://$PROJECT_DIR$/auto_star_urge.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-321"> <state relative-caret-position="-321">
...@@ -803,35 +810,79 @@ ...@@ -803,35 +810,79 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/auto_click_n.py"> <entry file="file://$PROJECT_DIR$/auto_star_topic.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1050"> <state relative-caret-position="145">
<caret line="70" column="16" selection-start-line="70" selection-start-column="16" selection-end-line="70" selection-end-column="16" /> <caret line="20" column="60" selection-start-line="20" selection-start-column="60" selection-end-line="20" selection-end-column="60" />
<folding> <folding>
<element signature="e#0#15#0" expanded="true" /> <element signature="e#0#15#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/auto_follow.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="34" column="16" selection-start-line="34" selection-start-column="16" selection-end-line="34" selection-end-column="16" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/auto_click.py"> <entry file="file://$PROJECT_DIR$/auto_click.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="251"> <state relative-caret-position="347">
<caret line="50" column="30" lean-forward="true" selection-start-line="50" selection-start-column="30" selection-end-line="50" selection-end-column="30" /> <caret line="32" column="16" selection-start-line="32" selection-start-column="16" selection-end-line="32" selection-end-column="16" />
<folding> <folding>
<element signature="e#0#11#0" expanded="true" /> <element signature="e#0#11#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/auto_star_topic.py"> <entry file="file://$PROJECT_DIR$/auto_click_n.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195"> <state relative-caret-position="525">
<caret line="21" column="24" lean-forward="true" selection-start-line="21" selection-start-column="24" selection-end-line="21" selection-end-column="24" /> <caret line="35" column="17" selection-start-line="35" selection-start-column="17" selection-end-line="35" selection-end-column="17" />
<folding> <folding>
<element signature="e#0#15#0" expanded="true" /> <element signature="e#0#15#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/auto_commnet.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="396">
<caret line="38" column="16" selection-start-line="38" selection-start-column="16" selection-end-line="38" selection-end-column="16" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/auto_every_day.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="417">
<caret line="50" column="16" selection-start-line="50" selection-start-column="16" selection-end-line="50" selection-end-column="16" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/auto_follow_majia.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1155">
<caret line="77" column="31" lean-forward="true" selection-start-line="77" selection-start-column="31" selection-end-line="77" selection-end-column="31" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/auto_follow_new.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-3">
<caret line="51" column="22" lean-forward="true" selection-start-line="51" selection-start-column="22" selection-end-line="51" selection-end-column="22" />
</state>
</provider>
</entry>
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -30,7 +30,7 @@ def get_data(numtime): ...@@ -30,7 +30,7 @@ def get_data(numtime):
return topic_id_list return topic_id_list
except: except:
logging.error("catch exception,get_data:%s" % traceback.format_exc()) logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None return []
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -19,20 +19,21 @@ def get_data(numtime): ...@@ -19,20 +19,21 @@ def get_data(numtime):
data = cursor.fetchall() data = cursor.fetchall()
topic_id = list(data) topic_id = list(data)
topic_id_list = [] topic_id_list = []
for i in topic_id: if topic_id:
cursor.execute( for i in topic_id:
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0") cursor.execute(
data = cursor.fetchall() "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
user_id = list(data) data = cursor.fetchall()
if user_id: user_id = list(data)
topic_id_list.append(i) if user_id:
logging.info("Database version : %s " % topic_id_list) topic_id_list.append(i)
pc.close() logging.info("Database version : %s " % topic_id_list)
return topic_id_list pc.close()
return topic_id_list
except: except:
logging.error("catch exception,get_data:%s" % traceback.format_exc()) logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None return []
if __name__ == "__main__": if __name__ == "__main__":
...@@ -49,33 +50,35 @@ if __name__ == "__main__": ...@@ -49,33 +50,35 @@ if __name__ == "__main__":
dict = {} dict = {}
for i in user_id: if user_id:
for i in user_id:
if i[0] not in dict.keys(): if i[0] not in dict.keys():
dict.setdefault(i[0], []) dict.setdefault(i[0], [])
dict[i[0]].append(i[1]) dict[i[0]].append(i[1])
else: else:
dict[i[0]].append(i[1]) dict[i[0]].append(i[1])
for key, value in dict.items(): for key, value in dict.items():
rand_num = random.randint(0, len(value) - 1) rand_num = random.randint(0, len(value) - 1)
rand_id = value[rand_num] rand_id = value[rand_num]
urge_num = random.randint(0, 1) urge_num = random.randint(0, 1)
for i in range(urge_num): for i in range(urge_num):
time.sleep(random.randint(1, 10)) time.sleep(random.randint(1, 10))
cook = login() cook = login()
if cook is not None: if cook is not None:
click(cook, rand_id) click(cook, rand_id)
except: except:
logging.error("catch exception,main:%s" % traceback.format_exc()) logging.error("catch exception,main:%s" % traceback.format_exc())
...@@ -22,20 +22,21 @@ def get_topic_id(numtime): ...@@ -22,20 +22,21 @@ def get_topic_id(numtime):
topic_id = list(data) topic_id = list(data)
logging.info("Database version : %s " % topic_id) logging.info("Database version : %s " % topic_id)
topic_id_list = [] topic_id_list = []
for i in topic_id: if topic_id:
cursor.execute( for i in topic_id:
"select user_id from user_extra where user_id =" + str(i[1]) + " and is_shadow =0 ") cursor.execute(
data = cursor.fetchall() "select user_id from user_extra where user_id =" + str(i[1]) + " and is_shadow =0 ")
user_id = list(data) data = cursor.fetchall()
if user_id: user_id = list(data)
topic_id_list.append(i) if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close() logging.info("Database version : %s " % topic_id_list)
return topic_id_list pc.close()
return topic_id_list
except: except:
logging.error("catch exception,get_data:%s" % traceback.format_exc()) logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None return []
if __name__ == "__main__": if __name__ == "__main__":
...@@ -52,41 +53,43 @@ if __name__ == "__main__": ...@@ -52,41 +53,43 @@ if __name__ == "__main__":
dicts = {} dicts = {}
for i in topic_id: if topic_id:
for i in topic_id:
if i[1] not in dicts.keys(): if i[1] not in dicts.keys():
dicts.setdefault(i[1], []) dicts.setdefault(i[1], [])
dicts[i[1]].append(i[0]) dicts[i[1]].append(i[0])
else: else:
dicts[i[1]].append(i[0]) dicts[i[1]].append(i[0])
logging.info("get dicts:%s" % dicts) logging.info("get dicts:%s" % dicts)
for key, value in dicts.items(): for key, value in dicts.items():
rand_num = random.randint(0, len(value) - 1) rand_num = random.randint(0, len(value) - 1)
rand_id = value[rand_num] rand_id = value[rand_num]
comment = get_comment() comment = get_comment()
logging.info("get comment:%s" % comment) logging.info("get comment:%s" % comment)
for i in range(1): for i in range(1):
time.sleep(random.randint(10, 20)) time.sleep(random.randint(10, 20))
cook = login() cook = login()
print(cook) print(cook)
if cook is not None: if cook is not None:
reply(cook, key, comment) reply(cook, key, comment)
time.sleep(300) time.sleep(300)
except: except:
logging.error("catch exception,main :%s" % traceback.format_exc()) logging.error("catch exception,main :%s" % traceback.format_exc())
...@@ -25,28 +25,30 @@ def get_topic_new_user(numtime): ...@@ -25,28 +25,30 @@ def get_topic_new_user(numtime):
new_user_data = list(new_user_data) new_user_data = list(new_user_data)
topic_id_list = [] topic_id_list = []
for i in topic_data: if topic_data :
cursor.execute( for i in topic_data:
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0") cursor.execute(
data = cursor.fetchall() "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
user_id = list(data) data = cursor.fetchall()
if user_id: user_id = list(data)
topic_id_list.append(i) if user_id:
topic_id_list.append(i)
for i in new_user_data:
cursor.execute( if new_user_data:
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0") for i in new_user_data:
data = cursor.fetchall() cursor.execute(
user_id = list(data) "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
if user_id: data = cursor.fetchall()
topic_id_list.append(i) user_id = list(data)
if user_id:
logging.info("Database version : %s " % topic_id_list) topic_id_list.append(i)
pc.close()
return topic_id_list logging.info("Database version : %s " % topic_id_list)
pc.close()
return topic_id_list
except: except:
logging.error("catch exception,get_data:%s" % traceback.format_exc()) logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None return []
if __name__ == "__main__": if __name__ == "__main__":
...@@ -60,16 +62,18 @@ if __name__ == "__main__": ...@@ -60,16 +62,18 @@ if __name__ == "__main__":
for i in range(follow_num): for i in range(follow_num):
for j in user_id: if user_id:
for j in user_id:
id = int(j[0]) id = int(j[0])
time.sleep(random.randint(10, 30)) time.sleep(random.randint(10, 30))
cookies = login() cookies = login()
if cookies is not None: if cookies is not None:
follow(cookies, id) follow(cookies, id)
except: except:
logging.error("catch exception,main:%s" % traceback.format_exc()) logging.error("catch exception,main:%s" % traceback.format_exc())
...@@ -19,19 +19,20 @@ def get_data(numtime): ...@@ -19,19 +19,20 @@ def get_data(numtime):
data = cursor.fetchall() data = cursor.fetchall()
user_id = list(data) user_id = list(data)
topic_id_list = [] topic_id_list = []
for i in user_id: if user_id:
cursor.execute( for i in user_id:
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0") cursor.execute(
data = cursor.fetchall() "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
id = list(data) data = cursor.fetchall()
if id: id = list(data)
topic_id_list.append(i) if id:
logging.info("Database version : %s " % topic_id_list) topic_id_list.append(i)
pc.close() logging.info("Database version : %s " % topic_id_list)
return topic_id_list pc.close()
return topic_id_list
except: except:
logging.error("catch exception,get_data:%s" % traceback.format_exc()) logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None return []
if __name__ == "__main__": if __name__ == "__main__":
...@@ -52,17 +53,19 @@ if __name__ == "__main__": ...@@ -52,17 +53,19 @@ if __name__ == "__main__":
for i in range(follow_num): for i in range(follow_num):
for j in user_id: if user_id:
id = int(j[0]) for j in user_id:
time.sleep(random.randint(1, 10)) id = int(j[0])
cookies = login() time.sleep(random.randint(1, 10))
if cookies is not None: cookies = login()
follow(cookies, id)
time.sleep(300) if cookies is not None:
follow(cookies, id)
time.sleep(300)
except: except:
logging.error("catch exception,main:%s" % traceback.format_exc()) logging.error("catch exception,main:%s" % traceback.format_exc())
...@@ -26,7 +26,7 @@ def get_follw_majia(numtime): ...@@ -26,7 +26,7 @@ def get_follw_majia(numtime):
return data return data
except: except:
logging.error("catch exception,get_data:%s" % traceback.format_exc()) logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None return []
if __name__ == "__main__": if __name__ == "__main__":
...@@ -39,44 +39,48 @@ if __name__ == "__main__": ...@@ -39,44 +39,48 @@ if __name__ == "__main__":
dict_follow_id = {} dict_follow_id = {}
for j in data: if data:
if j[2] != None: for j in data:
if j[0] not in dict_follow_id.keys(): if j[2] != None:
dict_follow_id.setdefault(j[0], []) if j[0] not in dict_follow_id.keys():
dict_follow_id[j[0]].append(j[2]) dict_follow_id.setdefault(j[0], [])
else: dict_follow_id[j[0]].append(j[2])
dict_follow_id[j[0]].append(j[2])
else:
dict_follow_id[j[0]].append(j[2])
dict_email = {} dict_email = {}
for j in data: if data:
for j in data:
if j[2] != None: if j[2] != None:
if j[0] not in dict_email.keys(): if j[0] not in dict_email.keys():
dict_email.setdefault(j[0], []) dict_email.setdefault(j[0], [])
dict_email[j[0]].append(j[1]) dict_email[j[0]].append(j[1])
else: else:
dict_email[j[0]].append(j[1]) dict_email[j[0]].append(j[1])
for key, value in dict_follow_id.items(): for key, value in dict_follow_id.items():
id = dict_email[key][0] id = dict_email[key][0]
for i in value: for i in value:
cookies = login(id) cookies = login(id)
if cookies is not None: if cookies is not None:
follow(cookies, i) follow(cookies, i)
except: except:
logging.error("catch exception,main:%s" % traceback.format_exc()) logging.error("catch exception,main:%s" % traceback.format_exc())
...@@ -50,7 +50,7 @@ def get_commnet_id(numtime): ...@@ -50,7 +50,7 @@ def get_commnet_id(numtime):
data_reply = list(data_reply_reply) data_reply = list(data_reply_reply)
topic_id_list = [] topic_id_list = []
for i in data_id: for i in data_id and data_id:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall() data = cursor.fetchall()
...@@ -58,7 +58,7 @@ def get_commnet_id(numtime): ...@@ -58,7 +58,7 @@ def get_commnet_id(numtime):
if user_id: if user_id:
topic_id_list.append(i) topic_id_list.append(i)
for i in data1_id: for i in data1_id and data1_id:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall() data = cursor.fetchall()
...@@ -66,7 +66,7 @@ def get_commnet_id(numtime): ...@@ -66,7 +66,7 @@ def get_commnet_id(numtime):
if user_id: if user_id:
topic_id_list.append(i) topic_id_list.append(i)
for i in data2_id: for i in data2_id and data2_id:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall() data = cursor.fetchall()
...@@ -74,7 +74,7 @@ def get_commnet_id(numtime): ...@@ -74,7 +74,7 @@ def get_commnet_id(numtime):
if user_id: if user_id:
topic_id_list.append(i) topic_id_list.append(i)
for i in data3_id: for i in data3_id and data3_id:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall() data = cursor.fetchall()
...@@ -82,15 +82,7 @@ def get_commnet_id(numtime): ...@@ -82,15 +82,7 @@ def get_commnet_id(numtime):
if user_id: if user_id:
topic_id_list.append(i) topic_id_list.append(i)
for i in data1_id: for i in data_reply and data_reply:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
for i in data_reply:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall() data = cursor.fetchall()
...@@ -113,7 +105,7 @@ if __name__ == "__main__": ...@@ -113,7 +105,7 @@ if __name__ == "__main__":
user_id = get_commnet_id(numtime) user_id = get_commnet_id(numtime)
for j in user_id: for j in user_id and user_id:
id = int(j[0]) id = int(j[0])
......
...@@ -19,7 +19,7 @@ def get_data(numtime): ...@@ -19,7 +19,7 @@ def get_data(numtime):
data = cursor.fetchall() data = cursor.fetchall()
user_id = list(data) user_id = list(data)
topic_id_list = [] topic_id_list = []
for i in user_id: for i in user_id and user_id:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall() data = cursor.fetchall()
...@@ -42,7 +42,7 @@ if __name__ == "__main__": ...@@ -42,7 +42,7 @@ if __name__ == "__main__":
user_id = get_data(numtime) user_id = get_data(numtime)
urge_num = random.randint(0, 1) urge_num = random.randint(0, 1)
for j in range(urge_num): for j in range(urge_num):
for i in user_id: for i in user_id and user_id:
id = int(i[0]) id = int(i[0])
time.sleep(random.randint(10, 30)) time.sleep(random.randint(10, 30))
cook = login() cook = login()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment