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