Skip to content

Commit b49ac2f

Browse files
committed
微博视频解析
1 parent 12801b1 commit b49ac2f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/src/main/java/name/caiyao/microreader/ui/adapter/VideoAdapter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ public void onCompleted() {
136136
@Override
137137
public void onError(Throwable e) {
138138
if (progressDialog.isShowing()) {
139+
e.printStackTrace();
139140
progressDialog.dismiss();
140141
Toast.makeText(mContext, "视频解析失败!", Toast.LENGTH_SHORT).show();
141142
mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(weiboVideoBlog.getBlog().getPageInfo().getVideoUrl())));
@@ -149,7 +150,7 @@ public void onNext(ResponseBody responseBody) {
149150
progressDialog.dismiss();
150151
try {
151152
String shareUrl;
152-
Pattern pattern = Pattern.compile("href\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\"'>\\s]+)).*target=\"blank\">http");
153+
Pattern pattern = Pattern.compile(".*?target=\"_blank\">(.*?)</a>.*?");
153154
final Matcher matcher = pattern.matcher(responseBody.string());
154155
shareUrl = weiboVideoBlog.getBlog().getPageInfo().getVideoUrl();
155156
if (TextUtils.isEmpty(shareUrl)) {

0 commit comments

Comments
 (0)