@@ 126-147 (lines=22) @@ | ||
123 | except Exception as ex: |
|
124 | pass |
|
125 | ||
126 | def user_list_gen(input_string,follower_name): |
|
127 | ''' |
|
128 | This function extract usernames from raw_html |
|
129 | :param input_string: raw input html |
|
130 | :param follower_name: follower_name |
|
131 | :type input_string:str |
|
132 | :type follower_name:str |
|
133 | :return: user_list as list |
|
134 | ''' |
|
135 | try: |
|
136 | user_list = [] |
|
137 | index = 0 |
|
138 | while(index!=-1): |
|
139 | index=input_string.find('alt="@',index+6,len(input_string)) |
|
140 | length=input_string[index+6:].find('"') |
|
141 | user_name=input_string[index+6:index+6+length] |
|
142 | if user_name!=follower_name: |
|
143 | if user_name!=follower_name: |
|
144 | user_list.append(user_name) |
|
145 | return user_list[:-1] |
|
146 | except Exception as ex: |
|
147 | pass |
|
148 | def get_html(url): |
|
149 | ''' |
|
150 | This function extract raw_html file |
|
@@ 81-102 (lines=22) @@ | ||
78 | :return: github star url as string |
|
79 | ''' |
|
80 | return "https://github.com/"+Name+"?page="+str(page_number)+"&tab=stars" |
|
81 | def repo_extract(input_string,username): |
|
82 | ''' |
|
83 | This function extract repo from raw_html |
|
84 | :param input_string: raw input html |
|
85 | :param user_name: user_name |
|
86 | :type input_string:str |
|
87 | :type user_name:str |
|
88 | :return: repo_list as list |
|
89 | ''' |
|
90 | try: |
|
91 | user_list=[] |
|
92 | index=0 |
|
93 | shift=len(username)+1 |
|
94 | while(index!=-1): |
|
95 | index=input_string.find('src="/'+username,index+shift,len(input_string)) |
|
96 | length=input_string[index:].find('graphs/') |
|
97 | star_repo=input_string[index+5:index+length] |
|
98 | if star_repo.find("<svg")==-1 and len(star_repo)!=0: |
|
99 | user_list.append(star_repo) |
|
100 | return user_list |
|
101 | except Exception as ex: |
|
102 | pass |
|
103 | ||
104 | def star_extract(input_string): |
|
105 | ''' |
|
@@ 104-124 (lines=21) @@ | ||
101 | except Exception as ex: |
|
102 | pass |
|
103 | ||
104 | def star_extract(input_string): |
|
105 | ''' |
|
106 | This function extract stared repo from raw_html |
|
107 | :param input_string: raw input html |
|
108 | :param follower_name: follower_name |
|
109 | :type input_string:str |
|
110 | :type follower_name:str |
|
111 | :return: user_list as list |
|
112 | ''' |
|
113 | user_list=[] |
|
114 | index=0 |
|
115 | try: |
|
116 | while(index!=-1): |
|
117 | index=input_string.find('<a class="muted-link mr-3',index+33,len(input_string)) |
|
118 | length=input_string[index+33:].find('stargazers">\n') |
|
119 | star_repo=input_string[index+34:index+33+length] |
|
120 | if star_repo.find("<svg")==-1 and len(star_repo)!=0: |
|
121 | user_list.append(star_repo) |
|
122 | return user_list |
|
123 | except Exception as ex: |
|
124 | pass |
|
125 | ||
126 | def user_list_gen(input_string,follower_name): |
|
127 | ''' |