You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PaddleSpeech/tools/get_contributors.ipynb

147 lines
4.1 KiB

{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "automotive-trailer",
"metadata": {},
"outputs": [],
"source": [
"from selenium import webdriver\n",
"chromeOptions = webdriver.ChromeOptions()\n",
"driver = webdriver.Chrome('./chromedriver', chrome_options=chromeOptions)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "physical-croatia",
"metadata": {},
"outputs": [],
"source": [
"driver.get(\"https://github.com/PaddlePaddle/PaddleSpeech/graphs/contributors\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "seventh-latitude",
"metadata": {},
"outputs": [],
"source": [
"<h3 class=\"border-bottom p-2 lh-condensed\">\n",
" <a data-hovercard-type=\"user\" data-hovercard-url=\"/users/zh794390558/hovercard\" href=\"/zh794390558\"\n",
" class=\"d-inline-block mr-2 float-left\">\n",
" <img src=\"https://avatars.githubusercontent.com/u/3038472?s=60&amp;v=4\" class=\"avatar avatar-user\"\n",
" alt=\"zh794390558\" width=\"38\" height=\"38\">\n",
" </a>\n",
" <span class=\"f5 text-normal color-fg-muted float-right\">#1</span>\n",
" <a data-hovercard-type=\"user\" data-hovercard-url=\"/users/zh794390558/hovercard\" class=\"text-normal\"\n",
" href=\"/zh794390558\">zh794390558</a>\n",
" <span class=\"f6 d-block color-fg-muted\">\n",
" <span class=\"cmeta\">\n",
" <div>\n",
" <a href=\"https://github.com/PaddlePaddle/PaddleSpeech/commits?author=zh794390558\"\n",
" class=\"Link--secondary text-normal\">655 commits</a>\n",
" &nbsp;&nbsp;\n",
" <span class=\"color-fg-success text-normal\">3,671,956 ++</span>\n",
" &nbsp;&nbsp;\n",
" <span class=\"color-fg-danger text-normal\">1,966,288 --</span>\n",
" </div>\n",
" </span>\n",
" </span>\n",
"</h3>"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "modified-argument",
"metadata": {},
"outputs": [],
"source": [
"from selenium.webdriver.common.by import By"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "demonstrated-aging",
"metadata": {},
"outputs": [],
"source": [
"elements = driver.find_elements(By.CLASS_NAME, 'lh-condensed')\n",
"for element in elements:\n",
" zhuye = element.find_elements(By.CLASS_NAME, 'd-inline-block')[0].get_attribute(\"href\")\n",
" img = element.find_elements(By.CLASS_NAME, 'avatar')[0].get_attribute(\"src\")\n",
" mkdown = f\"\"\"<a href=\"{zhuye}\"><img src=\"{img}\" width=75 height=75></a>\"\"\"\n",
" print(mkdown)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "general-torture",
"metadata": {},
"outputs": [],
"source": [
"element.find_elements(By.CLASS_NAME, 'd-inline-block')[0].get_attribute(\"href\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "downtown-institute",
"metadata": {},
"outputs": [],
"source": [
"element.find_elements(By.CLASS_NAME, 'avatar')[0].get_attribute(\"src\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "worthy-planet",
"metadata": {},
"outputs": [],
"source": [
"len(elements)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 5
}