java web程序 用新浪微博第三方登录,直接跳转到回调页面了,没有看到授权页面

Python016

java web程序 用新浪微博第三方登录,直接跳转到回调页面了,没有看到授权页面,第1张

这种情况应该是用户已经授过权了吧,如果用户对你应用未授权,在登录后会自动进入授权页面,是否对应用授权,可以在应用->我的应用里看到是否有你的应用,如果有删除后,再登录你的应用就会进授权页

package jsoupTest

import java.io.IOException

import java.util.ArrayList

import java.util.HashMap

import java.util.List

import java.util.Map

import org.jsoup.Connection.Method

import org.jsoup.Connection.Response

import org.jsoup.Jsoup

public class JsoupTest {

  public static void main(String[] args) throws IOException {

    Map<String, String> map = new HashMap<>()

    //map.put请根据自己的微博cookie得到

    Response res = Jsoup.connect("http://weibo.com/u/别人的主页id")

        .cookies(map).method(Method.GET).execute()

    String s = res.body()

    System.out.println(s)

    String[] ss = s.split("<script>FM.view")

    int i = 0

    // pl_content_homeFeed

    // pl.content.homeFeed.index

    List<String> list = new ArrayList<>()

    for (String x : ss) {

// System.out.println(i++ + "======================================")

// System.out.println(x.substring(0,

// x.length() > 200 ? 200 : x.length()))

// System.out.println("===========================================")

      if (x.contains("\"html\":\"")) {

        String value = getHtml(x)

        list.add(value)

        System.out.println(value)

      }

    }

    // content=ss[8].split("\"html\":\"")[1].replaceAll("(\\\\t|\\\\n)",

    // "").replaceAll("\\\\\"", "\"").replaceAll("\\\\/", "/")

    // content=content.substring(0,

    // content.length()<=13?content.length():content.length()-13)

    // System.out.println(Native2AsciiUtils.ascii2Native(content))

  }

  public static String getHtml(String s) {

    String content = s.split("\"html\":\"")[1]

        .replaceAll("(\\\\t|\\\\n)", "").replaceAll("\\\\\"", "\"")

        .replaceAll("\\\\/", "/")

    content = content.substring(0,

        content.length() <= 13 ? content.length()

            : content.length() - 13)

    return Native2AsciiUtils.ascii2Native(content)

  }