| 72 | |
| 73 | |
| 74 | def save_to_excel(soup): |
| 75 | list = soup.find(class_='video-list clearfix').find_all(class_='video-item matrix') |
| 76 | |
| 77 | for item in list: |
| 78 | item_title = item.find('a').get('title') |
| 79 | item_link = item.find('a').get('href') |
| 80 | item_dec = item.find(class_='des hide').text |
| 81 | item_view = item.find(class_='so-icon watch-num').text |
| 82 | item_biubiu = item.find(class_='so-icon hide').text |
| 83 | item_date = item.find(class_='so-icon time').text |
| 84 | |
| 85 | print('爬取:' + item_title) |
| 86 | |
| 87 | global n |
| 88 | |
| 89 | sheet.write(n, 0, item_title) |
| 90 | sheet.write(n, 1, item_link) |
| 91 | sheet.write(n, 2, item_dec) |
| 92 | sheet.write(n, 3, item_view) |
| 93 | sheet.write(n, 4, item_biubiu) |
| 94 | sheet.write(n, 5, item_date) |
| 95 | |
| 96 | n = n + 1 |
| 97 | |
| 98 | |
| 99 | def get_source(): |