python爬虫24 | 搞事情了,用 Appium 爬取你的微信朋友圈。
.radius_avatar img { display: block; width: 100%; height: 100%; border-radius: 50%; -moz-border-radius: 50%; -webkit-border-radius: 50%; background-color: rgba(238, 238, 238, 1) }
.rich_media_inner { word-wrap: break-word; -webkit-hyphens: auto; -ms-hyphens: auto; hyphens: auto }
.rich_media_area_primary { padding: 20px 16px 12px; background-color: rgba(250, 250, 250, 1) }
.rich_media_area_primary.voice { padding-top: 66px }
.rich_media_area_primary .weui-loadmore_line .weui-loadmore__tips { color: rgba(0, 0, 0, 0.3); background-color: rgba(250, 250, 250, 1) }
.rich_media_area_extra { padding: 0 16px 24px }
.rich_media_extra { padding-top: 30px }
.mpda_bottom_container .rich_media_extra { padding-top: 24px }
.mpda_bottom_container .rich_media_extra .mpad_more_list { right: -10px }
html { -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; line-height: 1.6 }
body { -webkit-touch-callout: none; font-family: -apple-system-font, BlinkMacSystemFont, “Helvetica Neue”, “PingFang SC”, “Hiragino Sans GB”, “Microsoft YaHei UI”, “Microsoft YaHei”, Arial, sans-serif; color: rgba(51, 51, 51, 1); background-color: rgba(242, 242, 242, 1); letter-spacing: 0.034em }
h1, h2, h3, h4, h5, h6 { font-weight: 400; font-size: 16px }
* { margin: 0; padding: 0 }
a { color: rgba(87, 107, 149, 1); text-decoration: none; -webkit-tap-highlight-color: rgba(0,0,0,0) }
.rich_media_title { font-size: 22px; line-height: 1.4; margin-bottom: 14px }
@supports (-webkit-overflow-scrolling: touch) { .rich_media_title { font-weight: 700 } }
.rich_media_meta_list { margin-bottom: 22px; line-height: 20px; font-size: 0; word-wrap: break-word; word-break: break-all }
.rich_media_meta_list em { font-style: normal }
.rich_media_meta { display: inline-block; vertical-align: middle; margin: 0 10px 10px 0; font-size: 15px; -webkit-tap-highlight-color: rgba(0,0,0,0) }
.rich_media_meta.icon_appmsg_tag { margin-right: 4px }
.rich_media_meta.meta_tag_text { margin-right: 0 }
.rich_media_meta_primary { display: block; margin-bottom: 10px; font-size: 15px }
.meta_original_tag { padding: 0 0.5em; font-size: 12px; line-height: 1.4; background-color: rgba(242, 242, 242, 1); color: rgba(136, 136, 136, 1) }
.meta_enterprise_tag img { width: 30px; height: 30px !important; display: block; position: relative; margin-top: -3px; border: 0 }
.rich_media_meta_link { color: rgba(87, 107, 149, 1) }
.rich_media_meta_text { color: rgba(0, 0, 0, 0.3) }
.rich_media_meta_text.rich_media_meta_split { padding-left: 10px }
.rich_media_meta_text.rich_media_meta_split:before { position: absolute; top: 50%; left: 0; margin-top: -6px; content: ” “; display: block; border-left: 1px solid rgba(136, 136, 136, 1); width: 200%; height: 130%; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -webkit-transform: scale(0.5); transform: scale(0.5); -webkit-transform-origin: 0 0; transform-origin: left top }
.rich_media_meta_text.article_modify_tag { position: relative }
.rich_media_meta_nickname { position: relative }
.rich_media_thumb_wrp { margin-bottom: 6px }
.rich_media_thumb_wrp .original_img_wrp { display: block }
.rich_media_thumb { display: block; width: 100% }
.rich_media_content { overflow: hidden; color: rgba(51, 51, 51, 1); font-size: 17px; word-wrap: break-word; -webkit-hyphens: auto; -ms-hyphens: auto; hyphens: auto; text-align: justify; position: relative; z-index: 0 }
.rich_media_content * { max-width: 100% !important; box-sizing: border-box !important; -webkit-box-sizing: border-box !important; word-wrap: break-word !important }
.rich_media_content p { clear: both; min-height: 1em }
.rich_media_content em { font-style: italic }
.rich_media_content fieldset { min-width: 0 }
.rich_media_content .list-paddingleft-1, .rich_media_content .list-paddingleft-2, .rich_media_content .list-paddingleft-3 { padding-left: 2.2em }
.rich_media_content .list-paddingleft-1 .list-paddingleft-2, .rich_media_content .list-paddingleft-2 .list-paddingleft-2, .rich_media_content .list-paddingleft-3 .list-paddingleft-2 { padding-left: 30px }
.rich_media_content .list-paddingleft-1 { padding-left: 1.2em }
.rich_media_content .list-paddingleft-3 { padding-left: 3.2em }
.rich_media_content .code-snippet, .rich_media_content .code-snippet__fix { max-width: 1000% !important }
.rich_media_content .code-snippet *, .rich_media_content .code-snippet__fix * { max-width: 1000% !important }
img { height: auto !important }
@media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait) { .rich_media_area_extra { padding-bottom: 34px } }
@media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape) { .rich_media_area_primary { padding: 20px 60px 15px } .rich_media_area_extra { padding: 0 60px 21px } }
@media screen and (min-width: 1024px) { .rich_media_area_primary_inner, .rich_media_area_extra_inner { max-width: 677px; margin-left: auto; margin-right: auto } .rich_media_area_primary { padding-top: 32px } }
blockquote { padding-left: 10px; border-left: 3px solid rgba(219, 219, 219, 1); color: rgba(0, 0, 0, 0.5); font-size: 15px; padding-top: 4px; margin: 1em 0 }
.blockquote_info { color: rgba(0, 0, 0, 0.3); margin-top: 1.1764705882352942em; word-wrap: break-word; -webkit-hyphens: auto; -ms-hyphens: auto; hyphens: auto }
.blockquote_article { display: block }
.appmsg_share_notice { font-size: 16px; color: rgba(136, 136, 136, 1); position: relative; padding: 1.25em 0; margin-bottom: 1.75em }
.appmsg_share_notice:before { content: ” “; position: absolute; left: 0; top: 0; right: 0; height: 1px; border-top: 1px solid rgba(223, 223, 223, 1); -webkit-transform-origin: 0 0; transform-origin: left top; -webkit-transform: scaleY(0.5); transform: scaleY(0.5) }
.appmsg_share_notice:after { content: ” “; position: absolute; left: 0; bottom: 0; right: 0; height: 1px; border-bottom: 1px solid rgba(223, 223, 223, 1); -webkit-transform-origin: 0 100%; transform-origin: left bottom; -webkit-transform: scaleY(0.5); transform: scaleY(0.5) }
.appmsg_share_notice_hd { font-weight: 700; padding-bottom: 0.2em }
.dn { display: none }
.qa__card { font-size: 15px; margin: 20px 0; background-color: rgba(0, 0, 0, 0.03) }
.qa__card .qa__item { padding: 24px 0 16px 16px }
.qa__card .qa__item-question { padding-right: 16px }
.qa__card .qa__item-question-info { display: flex; align-items: center; color: rgba(0, 0, 0, 0.7); margin-bottom: 9px; font-size: 15px }
.qa__card .qa__item-info-avatar { width: 24px; height: 24px; border-radius: 2px; overflow: hidden; margin-right: 8px }
.qa__card .qa__item-info-avatar img { width: 100% }
.qa__card .qa__item-info-account { margin-right: 0.5em }
.qa__card .qa__item-question { margin-bottom: 24px }
.qa__card .qa__answers-question-title { font-size: 15px; margin-bottom: 8px }
.qa__card .qa__detail-question-content { color: rgba(0, 0, 0, 0.5); font-size: 15px }
.qa__card .qa__item-reply-content { padding-right: 16px }
.qa__card .qa__item-reply-head { color: rgba(0, 0, 0, 0.6); position: relative; padding-left: 10px; margin-bottom: 9px }
.qa__card .qa__item-reply-head::before { content: “”; display: block; width: 2px; height: 15px; background-color: rgba(26, 173, 25, 1); position: absolute; left: 0; top: 50%; transform: translateY(-50%) }
.qa__card .qa__detail-question-imgs { margin-top: 4px; color: rgba(87, 107, 149, 1) }
.qa__card .qa__show_detail { position: relative; padding: 16px 0; display: block; margin-top: 16px; margin-bottom: -16px; color: rgba(87, 107, 149, 1) }
.qa__card .qa__show_detail::before { content: “”; position: absolute; display: block; width: 100%; border-top: 1px solid rgba(0, 0, 0, 0.1); transform: scaleY(0.5); left: 0; top: 0; transform-origin: left top }
.qa__card .qa__show_detail::after { content: “”; display: block; width: 8px; height: 8px; border-top: 2px solid rgba(0, 0, 0, 0.3); border-right: 2px solid rgba(0, 0, 0, 0.3); transform: rotate(45deg) translateY(-50%); position: absolute; right: 16px; top: 50%; border-radius: 2px; transform-origin: center }
.qa__card-empty { line-height: 115px; color: rgba(0, 0, 0, 0.3); text-align: center }
.code-snippet { margin: 10px 0; display: block; overflow-x: auto; font-size: 14px; padding: 1em 1em 1em 3em; color: rgba(51, 51, 51, 1); position: relative; background-color: rgba(250, 250, 250, 1); border: 1px solid rgba(240, 240, 240, 1); border-radius: 2px; counter-reset: line 0; white-space: normal; -webkit-overflow-scrolling: touch }
.code-snippet code { text-align: left; font-size: 14px; display: block; white-space: pre-wrap; position: relative; font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace }
.code-snippet code::before { position: absolute; min-width: 1.5em; text-align: right; left: -2.5em; counter-increment: line 1; content: counter(line); display: inline; margin-right: 12px; color: rgba(0, 0, 0, 0.15) }
.code-snippet_nowrap code { white-space: pre; display: flex }
.code-snippet__fix { font-size: 14px; margin: 10px 0; display: flex; color: rgba(51, 51, 51, 1); position: relative; background-color: rgba(0, 0, 0, 0.03); border: 1px solid rgba(240, 240, 240, 1); border-radius: 2px; line-height: 26px }
.code-snippet__fix pre { overflow-x: auto; padding: 1em 1em 1em 0; white-space: normal; flex: 1; -webkit-overflow-scrolling: touch }
.code-snippet__fix code { text-align: left; font-size: 14px; display: flex; white-space: pre; position: relative; font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace }
.code-snippet__fix .code-snippet__line-index { counter-reset: line 0; flex-shrink: 0; height: 100%; padding: 1em; list-style-type: none }
.code-snippet__fix .code-snippet__line-index li { list-style-type: none; text-align: right }
.code-snippet__fix .code-snippet__line-index li::before { min-width: 1.5em; text-align: right; left: -2.5em; counter-increment: line 1; content: counter(line); display: inline; color: rgba(0, 0, 0, 0.15) }
.code-snippet__comment, .code-snippet__quote { color: rgba(175, 175, 175, 1); font-style: italic }
.code-snippet__keyword, .code-snippet__selector-tag, .code-snippet__subst { color: rgba(202, 125, 55, 1) }
.code-snippet__number, .code-snippet__literal, .code-snippet__variable, .code-snippet__template-variable, .code-snippet__tag .code-snippet__attr { color: rgba(14, 156, 229, 1) }
.code-snippet__string, .code-snippet__doctag { color: rgba(221, 17, 68, 1) }
.code-snippet__title, .code-snippet__section, .code-snippet__selector-id { color: rgba(221, 17, 68, 1) }
.code-snippet__subst { font-weight: normal }
.code-snippet__type, .code-snippet__class .code-snippet__title { color: rgba(14, 156, 229, 1) }
.code-snippet__tag, .code-snippet__name, .code-snippet__attribute { color: rgba(14, 156, 229, 1); font-weight: normal }
.code-snippet__regexp, .code-snippet__link { color: rgba(202, 125, 55, 1) }
.code-snippet__symbol, .code-snippet__bullet { color: rgba(221, 17, 68, 1) }
.code-snippet__built_in, .code-snippet__builtin-name { color: rgba(202, 125, 55, 1) }
.code-snippet__meta { color: rgba(175, 175, 175, 1) }
.code-snippet__deletion { background: rgba(255, 221, 221, 1) }
.code-snippet__addition { background: rgba(221, 255, 221, 1) }
.code-snippet__emphasis { font-style: italic }
.code-snippet__strong { font-weight: bold }
.cell { padding: 0.8em 0; display: block; position: relative }
.cell_hd, .cell_bd, .cell_ft { display: table-cell; vertical-align: middle; word-wrap: break-word; word-break: break-all; white-space: nowrap }
.cell_primary { width: 2000px; white-space: normal }
.flex_cell { padding: 10px 0; display: flex; -webkit-box-align: center; -webkit-align-items: center; -ms-flex-align: center; align-items: center }
.flex_cell_primary { width: 100%; -webkit-box-flex: 1; -webkit-flex: 1; -ms-flex: 1; box-flex: 1; flex: 1 }
.original_tool_area { display: block; padding: 0.75em 1em 0; -webkit-tap-highlight-color: rgba(0,0,0,0); color: rgba(51, 51, 51, 1); border: 1px solid rgba(234, 234, 234, 1); margin: 20px 0 }
.original_tool_area .tips_global { position: relative; padding-bottom: 0.5em; font-size: 15px }
.original_tool_area .tips_global:after { content: ” “; position: absolute; left: 0; bottom: 0; right: 0; height: 1px; border-bottom: 1px solid rgba(219, 219, 219, 1); -webkit-transform-origin: 0 100%; transform-origin: left bottom; -webkit-transform: scaleY(0.5); transform: scaleY(0.5) }
.original_tool_area .radius_avatar { width: 27px; height: 27px; padding: 0; margin-right: 0.5em }
.original_tool_area .radius_avatar img { height: 100% !important }
.original_tool_area .flex_cell_bd { width: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-wrap: normal }
.original_tool_area .flex_cell_ft { font-size: 14px; color: rgba(136, 136, 136, 1); padding-left: 1em; white-space: nowrap }
.original_tool_area .icon_access:after { content: ” “; display: inline-block; height: 8px; width: 8px; border-top: 1px solid rgba(203, 202, 208, 1); border-right: 1px solid rgba(203, 202, 208, 1); border-bottom: 0 solid rgba(203, 202, 208, 1); border-left: 0 solid rgba(203, 202, 208, 1); transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0); -ms-transform: matrix(0.71,0.71,-0.71,0.71,0,0); -webkit-transform: matrix(0.71,0.71,-0.71,0.71,0,0); position: relative; top: -1px }
.rich_media_global_msg { position: fixed; top: 0; left: 0; right: 0; padding: 0.85em 35px 0.85em 15px; z-index: 2; background-color: rgba(198, 224, 248, 1); color: rgba(136, 136, 136, 1); font-size: 12px }
.rich_media_global_msg .icon_closed { position: absolute; right: 15px; top: 50%; margin-top: -5px; line-height: 300px; overflow: hidden; -webkit-tap-highlight-color: rgba(0,0,0,0); background: url(“//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/icon_appmsg_msg_closed_sprite.2x42f400.png”) left top / 100% no-repeat rgba(0, 0, 0, 0); width: 11px; height: 11px; vertical-align: middle; display: inline-block; -webkit-background-size: 100% auto }
.rich_media_global_msg .icon_closed:active { background-position: 0 -17px }
.rich_media_global_msg.voice { color: rgba(26, 173, 25, 1); background-color: rgba(232, 246, 232, 1); padding-left: 43.3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.rich_media_global_msg.voice .ic_voice { position: absolute; top: 50%; margin-top: -10px; left: 15px; display: inline-block; width: 13.3px; height: 18.3px; background: url(“data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAA3CAYAAAB+fggjAAAAAXNSR0IArs4c6QAACb9JREFUaAW9WX9wVMUd3917d5cf/Agp1OTuQgIlQqUoI1JI1Noojg2I+VU7hVrtDDpadRypgzKjU52x09KOdsS20ypSO/WPWttcAqhTOlSoU4FIoRUn0wEZIMndBUkwGEhyv97bfvaS97L77t3lHYUuc+z3935397vf/e4LJZfQnuPPsW0d25ZQzr9mELKSUnIVzHxB/Dh+lBOKf4OEk0FOyQAl/CyltIt5tL29d/V2FzIkLUQ4FA7dwon+KCF0Fee8rBBdS5aSs/D+PUrYbyKtkb9b9BzAlA7CERrqDN1DOH8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kGAez3zcIHmfj44rKAYUd2Jxcek6HCP1cHD+Ig5DzonZnT3WdOyCWFGukRUIwkGTL069kdYz319MmlOf00EhjKpiWKPku7IiDF9X3RHMecvIsjIsPqdh1ewO3SXLOMF5HRQKvS39h5GNOmVlnZP1Mu4W9pZ5/4TDZh0ybHkt3iKOqcm0OaWDQpB52DZTQfQo+Vtl3C08kQGO2OStYtlGz6CuHJxZO3MPYnHYMsDJVSKpW3ghAOXKsxaPoup86q4c7F7cncSyHZANGen0Shl3C+PSPy/L4qmZ97525aAwiMLgQ8Uwp8tl3C2MASff00KJMRW3GXLtIFbwY1kXp/kaGXcL42AoDqHit6p5JxuuHfQwj1IvIhFO9QhyGk/QpskM/C3Gyo0y3YRdOzgnNOcTHJS0qYgVrBIfLE28gF75ToN3bySfrmsHM68tTo7JxuKJ+PUyPhWcqbQ5XarI+TRlZxQeENcOjitS5dMc5/oqu8F8+ODI4FrEoPVpBTfL8akK2YIc9DCiFAkoyTbUdNSU5XPK5Im/MQPeZOKZnpNdCu6AFOTgrJLZO2FDrogrUjyxPbQ/VOxgWyG9Fn71h6hoJkMC8exlvl8qQg6I66rE1A22Vz6PEuwZExe92CrQtmmU72U+fzQ9K/15XV1dsuudrhlc50t0XX8Izq1TdAh5I9rWf69Mc4ILdlCU9kNDn32ICvZS0wySAY2W+shSUdw6OSXTCtpioSgePZrPeydWTUncstF8MPRw1dFvunFO2CnYQaGEk3cSn8iWYyVeBGoImqtG6RHxQsQfEJVskE+34C22GxOfb8fiY40owtaAJ0qnciTxcvSlE7VfBPX3IQ8lb/U2R3dgBRGu7tt/AYJkZEGv/oaXAAAAAElFTkSuQmCC”) center / contain no-repeat }
.rich_media_global_msg.voice .icon_more { position: absolute; right: 15px; top: 50%; margin-top: -6.5px; width: 8px; height: 13px; background: url(“data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAmCAYAAADeB1slAAAAAXNSR0IArs4c6QAAA49JREFUSA2tVk1IVFEUPveOmhQk1ibfvLF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cUqmBLrnSs4504s8GjLxrwm5qYrg3dKFf6x6VbwQ3yOS/wz8+bS0ruwfELaBY2nyoNkn4gvW65GKRn4WForwP+dONHDaOHeZAAAAAElFTkSuQmCC”) center / contain no-repeat }
.preview_appmsg .rich_media_title { margin-top: 2.3em }
@media screen and (min-width: 1024px) { .rich_media_global_msg { position: relative; margin-bottom: 32px } .preview_appmsg .rich_media_title.rich_media_title { margin-top: 0 } }
.pages_reset { color: rgba(51, 51, 51, 1); line-height: 1.6; font-size: 16px; font-weight: 400; font-style: normal; text-indent: 0; letter-spacing: normal; text-align: left; text-decoration: none; white-space: normal }
.weapp_element, .weapp_display_element, .mp-miniprogram { display: block; margin: 1em 0 }
.share_audio_context { margin: 16px 0 }
.weapp_text_link { font-size: 17px }
.weapp_text_link:before { content: “”; display: inline-block; line-height: 1; background-size: contain; background-repeat: no-repeat; background-image: url(“data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAB4RJREFUWAm1WUuMFGUQnn7szL5mdvbh7GwgEQUlS1weiagxxpigiUZeJgY1cMMDcDCGG8GLCWZvxHjh4BWUeDEsejBBEzWYKBBEiHAABBfCMOwsuzvszrvb+v6Zb7amt1ce0Up6qv6q+qq+/rv778dYkUeUqamp5dFodJPv++ts205blpX2PG8I5cTOiLol44zYZ8vl8vFkMnnlUVpZDwPK5/MpIbWrVqttFlLD0jwiBEHIaNbCGKJjQvai+I9Xq9VD8Xg8y9z76QcimM1mu3t6ej4UYh84jtOFxhBNJGxskhp5xIielZ37bHp6+tNUKnWPOYvp+xKcm5t7S4gclKIpFNGzsmjRkBnUOwNbZjQrtfZ2dnZ+vVgd+O1/CVqlUukjIXZYCqZADBuEJIllc4xh61zmaB9s7LDkHkYPwJgX1KEEx8fHO2TmjkjyPgLQmERIAjHajGnyjDGPOfQ3xvvQCz3ZS+sw5hYAsodbWBhNw4SNGCMBnR/MYS60jskhPyaHe7u4W5otmEGZ8v0g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KxXwJfByXeLRViUYGiI3F/NSYr1raPdNoXh594S75nVT1Z/mUz6kAfhGJp2EI887gRy5Bw0M/g7ndQI0gZISJkpyU6WbTm7m8RYELnFkh+ZnK4/qCTiWF4XXtk6X5NkLjX7iz4rh9keAxBODaKNWKrf9Qd627yC3Cm++2m6DbHWYpHI2Im7UfFZqf6oN9DrmAsPWIquH8QjR8dRG2O88JszW56kTwvRYSayOYtD37xdsT8/ejtWq/nWsqXttdXDHdW+RNTHY9Vv5/IuTgPHtfxd7w0V04/V1ziND5IiCeTofsyTw3tRnqyfNY9b8qg1JkktXwo0EKAlg23eO2/2l7/5YaoNTyPYNIFEt6xxr/aVQQ75QTxJkEBYnDFocEKOqYQHVnn+uiCBLji1IBnCBiVZ+U6fv+dmshV7cqpq9fY4/tBg1HtudXe1zeyuRs9fHMRrEvQBQT9smb1Z+YphHljr3cWJF2gB7NOENAhAjrWGP9iIPuZhDOFYa/hD8KOxWOyAweAHEnxpqnvrvyyofbQZg4boZsEcjrUO4mX2Wl6a6jdhQeAtSoJ70YDNoIMFwmJoqImF5Wgf8jHGRhx0Y9vLNzrkNQligPdRuZpHgyDEKIixMPMQow82/dC04YdgzFwdg0+2Uf1OjPzmOYhBQ6xCoYCX9626WDOo9pqNqHUO7IfBy0XxYJ8+UHdiYuJ9AHQT2GGiycHmmLNDkmFY+JCPXrlcbqcMW28/iCNpEcHnt/3SwHzhQiEIG5JAGDYsN8yHGjil5Ir9BKVDa4U5ta/xveagNDCfRBhDQ5JczEaujhHb0FlclMFzLpDTepEEgxijAL6VSCNcPLPw6aa0oSEgTZsx+GFjwyIsenRmZmbkfuQMDj8PKrjjyCHZIw02im7eGokHAQhnFjZ8GAux/+8jOhoFhX9DCIG1EsPfD9jMC5j4/rO/If4BCiyOk7IAfLMAAAAASUVORK5CYII=”); vertical-align: middle; font-size: 11px; color: rgba(136, 136, 136, 1); margin-right: 6px; margin-top: -3px; background-position: center; height: 20px; width: 20px }
.flex_context { display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center }
.flex_bd { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; word-wrap: break-word; word-break: break-all }
.original_page { background-color: rgba(255, 255, 255, 1); font-size: 16px }
.account_info { padding: 0 0 20px }
.account_info .flex_bd { padding-left: 0.85em }
.radius_avatar.account_avatar { width: 40px; height: 40px; padding: 0 }
.account_nickname { overflow: hidden; text-overflow: ellipsis; -webkit-box-orient: vertical; -webkit-line-clamp: 1; line-height: 1.2; color: rgba(87, 107, 149, 1); font-size: 14px }
.account_nickname_inner { font-weight: 400; vertical-align: top }
.account_desc { overflow: hidden; text-overflow: ellipsis; -webkit-box-orient: vertical; -webkit-line-clamp: 1; color: rgba(178, 178, 178, 1); font-size: 13px; line-height: 1.2; padding-top: 0.3em }
.account_desc_inner { display: inline; vertical-align: top }
.share_notice { margin-bottom: 20px; word-wrap: break-word; -webkit-hyphens: auto; -ms-hyphens: auto; hyphens: auto }
.share_media { padding-bottom: 18px }
.original_panel { padding: 20px; background-color: rgba(252, 252, 252, 1); word-wrap: break-word; -webkit-hyphens: auto; -ms-hyphens: auto; hyphens: auto; overflow: hidden; position: relative }
.original_panel:after { content: ” “; border: 1px solid rgba(216, 216, 216, 1); border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; position: absolute; top: 0; left: 0; width: 200%; height: 200%; -webkit-transform: scale(0.5); transform: scale(0.5); -webkit-transform-origin: 0 0; transform-origin: left top; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box }
.original_panel .original_account { margin-bottom: 18px; position: relative; z-index: 1 }
.original_panel .original_account_avatar { width: 28px; height: 28px; padding: 0 }
.original_panel .original_account_nickname { padding-left: 0.85em; font-size: 15px; color: rgba(87, 107, 149, 1) }
.original_panel_title { font-size: 23px; color: rgba(0, 0, 0, 1); margin: 0 0 16px }
.original_panel_content { color: rgba(51, 51, 51, 1) }
.original_panel_tool { padding-top: 20px; position: relative; z-index: 1 }
.original_tool_area.disabled { padding: 0 }
.original_tool_area.disabled .flex_cell_bd { -webkit-box-flex: initial; -webkit-flex: initial; -ms-flex: initial; box-flex: initial }
.original_tool_area.disabled .flex_cell_ft { -webkit-box-flex: 1; -webkit-flex: 1; -ms-flex: 1; box-flex: 1; flex: 1; padding: 0 }
.original_tool_area.disabled .original_tool_tips:after { content: “:” }
.original_tool_area.disabled .original_cell_nickname { color: rgba(0, 0, 0, 0.3); overflow: hidden; text-overflow: ellipsis; -webkit-box-orient: vertical; -webkit-line-clamp: 1; white-space: normal; max-width: none; min-height: 1.6em }
.original_tool_area.disabled:before, .original_tool_area.disabled:after, .original_tool_area.disabled .radius_avatar, .original_tool_area.disabled .icon_access:after { display: none }
.original_cell_nickname { display: inline-block; vertical-align: middle; font-weight: 400; width: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-wrap: normal; max-width: 8em; color: rgba(0, 0, 0, 1) }
.original_tool_area { padding: 1.17em 0; border-width: 0; position: relative }
.original_tool_area:before { content: ” “; position: absolute; left: 0; top: 0; right: 0; height: 1px; border-top: 1px solid rgba(223, 223, 223, 1); -webkit-transform-origin: 0 0; transform-origin: left top; -webkit-transform: scaleY(0.5); transform: scaleY(0.5) }
.original_tool_area:after { content: ” “; position: absolute; left: 0; bottom: 0; right: 0; height: 1px; border-bottom: 1px solid rgba(223, 223, 223, 1); -webkit-transform-origin: 0 100%; transform-origin: left bottom; -webkit-transform: scaleY(0.5); transform: scaleY(0.5) }
.original_tool_area .radius_avatar { width: 20px; height: 20px; margin-right: 0.2em }
.original_tool_area .flex_cell { padding: 0; font-size: 14px }
.original_tool_area .icon_access:after { margin-right: 4px; top: 0 }
.preview_appmsg .rich_media_title { margin-top: 1.5em }
.preview_appmsg .account_info { padding-top: 3em }
.original_page { background-color: rgba(0, 0, 0, 0) }
.account_info { -webkit-tap-highlight-color: rgba(0,0,0,0); outline: 0; padding-bottom: 20px; font-size: 14px }
.account_info.appmsg_account_info { padding-bottom: 32px }
.account_info .radius_avatar img { background-color: rgba(0, 0, 0, 0) }
.share_notice { font-size: 16px; word-wrap: break-word; -webkit-hyphens: auto; -ms-hyphens: auto; hyphens: auto }
.original_panel { background-color: rgba(250, 250, 250, 1) }
.original_panel:after { border-color: rgba(230, 230, 230, 1) }
.original_panel .original_account_avatar { width: 30px; height: 30px }
.original_panel_tool { font-size: 14px }
.original_panel_tool a { color: rgba(87, 107, 149, 1) }
.original_panel_content { font-size: 17px }
.share_media { padding-bottom: 30px }
.icon_appmsg_tag { display: inline-block; vertical-align: middle; padding: 0 0.5em; font-size: 12px; line-height: 1.5; background-color: rgba(195, 195, 195, 1); color: rgba(255, 255, 255, 1); border-radius: 2px; -moz-border-radius: 2px; -webkit-border-radius: 2px; width: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-wrap: normal; max-width: 70% }
.icon_appmsg_tag.primary { color: rgba(59, 182, 56, 1); padding: 4px 0.78em; background-color: rgba(9, 187, 7, 0.08); font-size: 12px; border-radius: 0.95em / 50%; -moz-border-radius-topleft: .95em 50%; -webkit-border-top-left-radius: .95em 50%; -moz-border-radius-topright: .95em 50%; -webkit-border-top-right-radius: .95em 50%; -moz-border-radius-bottomleft: .95em 50%; -webkit-border-bottom-left-radius: .95em 50%; -moz-border-radius-bottomright: .95em 50%; -webkit-border-bottom-right-radius: .95em 50% }
.icon_appmsg_tag.default { border: 1px solid rgba(0, 0, 0, 0.1); color: rgba(0, 0, 0, 0.3); background-color: rgba(0, 0, 0, 0); padding: 0 0.54em; font-size: 15px; line-height: 1.3; border-radius: 0.67em / 50%; -moz-border-radius-topleft: .67em 50%; -webkit-border-top-left-radius: .67em 50%; -moz-border-radius-topright: .67em 50%; -webkit-border-top-right-radius: .67em 50%; -moz-border-radius-bottomleft: .67em 50%; -webkit-border-bottom-left-radius: .67em 50%; -moz-border-radius-bottomright: .67em 50%; -webkit-border-bottom-right-radius: .67em 50% }
.rich_media_meta_list .icon_appmsg_tag.default { margin-top: -1px }
.icon_appmsg_tag.title_tag { background-color: rgba(208, 75, 78, 1) }
.icon_global_tag_wrp { text-align: right; padding-bottom: 12px }
.icon_global_tag { background-color: rgba(118, 118, 118, 0.16); color: rgba(0, 0, 0, 0.41); line-height: 2.2; border-top-left-radius: 1em 50%; -moz-border-radius-topleft: 1em 50%; -webkit-border-top-left-radius: 1em 50%; border-bottom-left-radius: 1em 50%; -moz-border-radius-bottomleft: 1em 50%; -webkit-border-bottom-left-radius: 1em 50%; padding: 0 1.8em 0 1.34em; font-size: 12px; margin-right: -24px; display: inline-block; vertical-align: top }
.global_plain_btn { display: inline-block; vertical-align: middle; padding: 0 1em; line-height: 2; font-size: 14px; -webkit-tap-highlight-color: rgba(0,0,0,0); border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px }
.global_plain_btn.primary { color: rgba(26, 173, 25, 1); border: 1px solid currentColor }
.global_plain_btn.primary:active { color: rgba(26, 173, 25, 0.6) }
.wx_video_context { color: rgba(254, 254, 254, 1); position: relative; background-color: rgba(0, 0, 0, 1) }
.wx_video_thumb, .wx_video_thumb_primary { position: absolute; left: 0; width: 100%; height: 100% !important; top: 0 }
.wx_video_thumb_primary { -webkit-background-size: cover; background-size: cover; background-position: center; background-repeat: no-repeat }
.wx_video_play_btn { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%,-50%); transform: translate(-50%, -50%); margin-top: -2px; font-size: 0; border-width: 0; background-color: rgba(0, 0, 0, 0); padding: 0; outline: 0; z-index: 2 }
.wx_video_play_btn:before { content: ” “; display: inline-block; width: 0; height: 0; border-top: 14px dotted rgba(0, 0, 0, 0); border-right: 0 dotted rgba(0, 0, 0, 0); border-bottom: 14px dotted rgba(0, 0, 0, 0); border-left: 25px solid rgba(255, 255, 255, 1) }
.wx_video_mask { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 1; background-color: rgba(0, 0, 0, 0.5) }
.place_audio_area { min-height: 100px; background-color: rgba(253, 253, 253, 1); display: block; margin: 16px 0 }
.place_music_area { min-height: 68px; background-color: rgba(253, 253, 253, 1); display: block; margin: 17px 0 16px }
.rich_media_empty_extra { background-color: rgba(250, 250, 250, 1) }
.appmsg_skin_default.rich_media_empty_extra { background-color: rgba(255, 255, 255, 1) }
.appmsg_skin_default .rich_media_area_primary { background-color: rgba(255, 255, 255, 1) }
.appmsg_skin_default .rich_media_area_primary .weui-loadmore_line .weui-loadmore__tips { background-color: rgba(255, 255, 255, 1) }
.appmsg_style_default .rich_media_tool { padding-top: 15px }
.rich_media_title_ios { font-weight: 700 }
.read-more__area { margin: 30px 0 }
.read-more__desc { margin-bottom: 10px }
.read-more__article__extra { font-size: 14px; color: rgba(0, 0, 0, 0.5) }
.read-more__article__item { margin-bottom: 10px }
昨天小帅b看到一些事情不顺眼
有人偷换概念
忍不住就写了一篇反讽 996 的
没想到有些人看不懂
这就算了
还来骂我
早些时候关注我的小伙伴应该知道我第一时间就发过反对 996 的文章
哎~
不过也好
洗掉一些无脑假粉丝
“你个假粉丝,小帅b不是蔡徐坤”
好了
进入正题
上次
小帅b跟你说了如何安装 Appium 的相关环境
以及让它自动打开了手机上的微信App
python爬虫23 | 手机,这次要让你上来自己动了。这就是 Appium+Python 的牛x之处
相信你已经跃跃欲试
想要来爬取一些手机上的 APP 数据了
那么这次
小帅b就带你爬取微信朋友圈的数据
接下来就是
友情提醒
本篇需要你先安装好 Appium 相关环境才可以哟,如果你还没安装的话快点出门左转,安装完之后再来这里玩耍。
ok
首先我们要知道微信这个 apk 的包名和启动页的 Activity
将你的 Android 鸡连接到电脑
在终端输入 adb devices 确保你已经将你的鸡连接到电脑
如果像上面这样出现设备名称就说明你连接上你的电脑了
如果你插进电脑之后还没发现有任何设备名称显示
那就记得打开 USB 调试,多拔插几次,总会连上的,这是过来人经验
接着
在你的手机里面打开微信
然后打开你的终端输入
adb shell
然后输入
dumpsys activity | grep mFocusedActivity
这时候我们就获取到微信的包名和启动页面的名称了
我们还要知道我们的手机是什么版本的
输入以下命令获取
adb shell getprop ro.build.version.release
那么现在我们就知道了这些必要的信息了
desired_caps = {}
desired_caps[\'platformName\'] = \'Android\'
desired_caps[\'platformVersion\'] = \'5.1\'
desired_caps[\'deviceName\'] = \'88CKBM622PAM\'
desired_caps[\'appPackage\'] = \'com.tencent.mm\'
desired_caps[\'appActivity\'] = \'.ui.LauncherUI\'
接下来
主要思路就是
自动开启微信
模拟登录微信
找到小帅b的朋友圈
把朋友圈的数据抓下来
想要模拟登录
我们就需要获取到微信的登录按钮这个元素
如何获取呢?
在你安装好的 sdkmanager 的 tool 目录下
有一个叫做 uiautomatorviewer 的工具
windows用户直接双击打开
ubuntu的话可以进入相应的目录
用命令 ./uiautomatorviewer 行打开
~/android/tools/bin$ ./uiautomatorviewer
打开之后是这个鸟样
我们点击菜单栏的第二个图标按钮
这时候你就会发现
手机的屏幕被抓过来了
用鼠标点一下登录按钮你会看到
相应的资源信息都被定位到了
那么要让它自动点击登录按钮就简单了
# 获取到登录按钮后点击
login_btn = self.wait.until(EC.element_to_be_clickable((By.ID, "com.tencent.mm:id/e4g")))
login_btn.click()
点击登录之后页面是这样的
我们要切换到用邮箱登录
还是老样子
我们获取到按钮,然后让它点击
# 获取使用微信号登录按钮
change_login_btn = self.wait.until(EC.element_to_be_clickable((By.ID, "com.tencent.mm:id/cou")))
change_login_btn.click()
那么接下来就输入账号密码了
恩
获取到账号和密码的 EditText 和 登录按钮
然后自动输入账号密码
最后点一下登录
# 获取输入账号元素并输入
account = self.wait.until(EC.presence_of_element_located((By.XPATH, \'//*[@resource-id="com.tencent.mm:id/cos"]/android.widget.EditText\')))
account.send_keys("你的微信账号")
# 获取密码元素并输入
password = self.wait.until(EC.presence_of_element_located((By.XPATH, \'//*[@resource-id="com.tencent.mm:id/cot"]/android.widget.EditText\')))
password.send_keys("你的微信密码")
# 登录
login = self.wait.until(EC.element_to_be_clickable((By.ID, "com.tencent.mm:id/cov")))
login.click()
登录之后会弹出一个界面
你愿意把你的通讯录授权给我吗?
呵呵
no!
# 点击去掉通讯录提示框
no_btn = self.wait.until(EC.element_to_be_clickable((By.ID, "com.tencent.mm:id/az9")))
no_btn.click()
这样
我们就成功登入微信了
接下来找到小帅b的微信
需要点击上方的搜索按钮
# 获取到搜索按钮后点击
search_btn = self.wait.until(EC.element_to_be_clickable((By.ID, "com.tencent.mm:id/iq")))
search_btn.click()
这时候会出现输入框
搜索小帅b本b
# 获取搜索框并输入
search_input = self.wait.until(EC.presence_of_element_located((By.ID, "com.tencent.mm:id/kh")))
search_input.send_keys("wistbean")
这时候会出现一个 item
没错
点击头像进去
# 点击头像进入
xiaoshuaib_btn = self.wait.until(EC.element_to_be_clickable((By.ID, "com.tencent.mm:id/py")))
xiaoshuaib_btn.click()
接下来几步都是一个道理
主要是进入小帅b的朋友圈
# 点击右上角...进入
menu_btn = self.wait.until(EC.element_to_be_clickable((By.ID, "com.tencent.mm:id/jy")))
menu_btn.click()
# 再点击头像
icon_btn = self.wait.until(EC.element_to_be_clickable((By.ID, "com.tencent.mm:id/e0c")))
icon_btn.click()
# 点击朋友圈
moment_btn = self.wait.until(EC.element_to_be_clickable((By.ID, "com.tencent.mm:id/d86")))
moment_btn.click()
就这样点进去
进入朋友圈之后
我们来分析一下
可以看到小帅b的朋友圈是这样的
我们需要滑动获取到更多内容
可以使用 Appium 的 swipe 方法
再来
我们需要循环获取到数据
可以看到每条朋友圈都被封装到 ListView 这个容器里面
所以我们要从这里面获取所有数据
然后再进行遍历
那么每一个具体的条目呢?
可以看到
数据被放在了 LinearLayout 的具体容器里面了
所以我们可以根据 id 获取相应的内容
# 获取 FrameLayout
items = self.wait.until(EC.presence_of_all_elements_located((By.ID, \'com.tencent.mm:id/eew\')))
# 滑动
self.driver.swipe(self.start_x, self.start_y, self.end_x, self.end_y, 2000)
#遍历获取
for item in items:
moment_text = item.find_element_by_id(\'com.tencent.mm:id/kt\').text
day_text = item.find_element_by_id(\'com.tencent.mm:id/eke\').text
month_text = item.find_element_by_id(\'com.tencent.mm:id/ekf\').text
print(\'抓取到小帅b朋友圈数据: %s\' % moment_text)
print(\'抓取到小帅b发布时间: %s月%s\' % (month_text, day_text))
至此
我们的代码写完了
来运行一下吧
首先打开 Appium
[Appium] Welcome to Appium v1.12.1
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
接着运行爬取朋友圈的代码
截取部分结果
微信启动...
登录成功...
搜索小帅b...
进入朋友圈...
抓取到小帅b朋友圈数据: 那天马云说:我从来没碰过钱,我对钱没兴趣。
最近马云说:能 996 是一种福气,我每天都 1212。
果然,有钱爸爸说话就是好听。
抓取到小帅b发布时间: 4月月12
抓取到小帅b朋友圈数据: 有本事双击我头像
抓取到小帅b发布时间: 4月月10
抓取到小帅b朋友圈数据: 刚点了外卖,小哥有点超时才送到。我倒不觉得有什么,可是小哥将餐物双手递给我后接下来的动作让我惊讶到了:
他对我深深地鞠了一躬……