163相册批量上传下载类(vb.net)

原创 2007年09月21日 19:03:00

 

'163相册的属性

Public Structure AlbumInfo

    Dim albumID, albumName, albumUrl, photoCount, albumDesc As String

End Structure

 

'163照片的属性

Public Structure PhotoInfo

    Dim photoID, photoDesc, photoSmallUrl, photoBigUrl As String

End Structure

 

 

'实现对163相册管理的类

Public Class Album163

 

    Friend http As New WebClient

    Dim r As System.Text.RegularExpressions.Regex

    Dim m As System.Text.RegularExpressions.Match

    Dim username, password As String

 

 

    '登录相册

    Function Login(ByVal username As String, ByVal password As String) As Boolean

        Me.username = username

        Me.password = password

 

        http.strUrl = "https://reg.163.com/logins.jsp"

 

        http.strTextField = "type=1&username=" + username + "&password=" + password

        http.Proc(True)

        http.cookiePost = http.cookieGet

        m = r.Match(http.RespHtml, "http://reg.163.com/Main.jsp/?username=" + username)

        If m.Success Then

            Return True

        Else

            Return False

        End If

    End Function

 

    '获取相册目录信息

    Function GetAlbums() As ArrayList

        http.strUrl = "http://photo.163.com/js/albumsinfo.php?user=" + username

        http.Proc()

 

        Dim arr() As String = Split(http.RespHtml, "gAlbumsInfo[")

 

        Dim i As Integer

        Dim albumsInfo As New ArrayList

        For i = 1 To UBound(arr)

 

            m = r.Match(arr(i), "(/d+)[^,]+,/d,(/d+),""([^""]+)"",""([^""]+)""")

            If m.Success Then

                Dim aInfo As AlbumInfo

                aInfo.albumID = m.Groups(1).Value

                aInfo.photoCount = m.Groups(2).Value

                aInfo.albumName = m.Groups(3).Value

                aInfo.albumDesc = m.Groups(4).Value

                albumsInfo.Add(aInfo)

            End If

        Next

        Return albumsInfo

    End Function

 

 

    '获取照片信息

    Function GetPhotos(ByVal albumID As String) As ArrayList

        http.strUrl = "http://photo.163.com/js/photosinfo.php?user=" + username + "&aid=" + albumID + "&level=2"

        http.Proc()

 

        Dim photosInfo As New ArrayList

        Dim pInfo As PhotoInfo

 

        m = r.Match(http.RespHtml, "gPhotosInfo/[(/d+)[^,]+,[^,]+,[^,]+,""([^""]*)"",""([^""]*)"",""([^""]*)""")

        Do While m.Success

            pInfo.photoID = m.Groups(1).Value

            pInfo.photoDesc = m.Groups(2).Value

            pInfo.photoSmallUrl = m.Groups(3).Value

            pInfo.photoBigUrl = m.Groups(4).Value

            photosInfo.Add(pInfo)

            m = m.NextMatch

        Loop

 

        Return photosInfo

    End Function

 

    '创建目录

    Function CreateAlbum(ByVal AlbumName As String, ByVal AlbumDesc As String, Optional ByVal power As String = "1") As String

 

        http.strUrl = "http://photo.163.com/pholder_new_pro.php"

        http.strRefUrl = "http://photo.163.com/pholder_new.php"

        http.strTextField = "albumname=" & AlbumName & "&albumdesc=" + AlbumDesc + "&bigclass=%C8%CB%CE%EF&newcate=1&lvl=" + power + "&create=%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%B4%B4%26nbsp%3B%26nbsp%3B%BD%A8%26nbsp%3B%26nbsp%3B%C4%BF%26nbsp%3B%26nbsp%3B%C2%BC%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B"

        http.Proc()

 

        m = r.Match(http.RespHtml, "(?<=/upload/)/d+")

        If m.Success Then

            Return m.Value

        Else

            Return "0"

        End If

    End Function

 

    '修改目录属性

    Function EditAlbum(ByVal albumID As String, ByVal albumName As String, ByVal albumDesc As String, Optional ByVal power As String = "1", Optional ByVal password As String = "") As Boolean

        http.strUrl = "http://photo.163.com/pholder_edit_pro.php"

        http.strTextField = "user=" + username + "&aid=" + albumID + "&albumname=" + albumName + "&albumdesc=" + albumDesc + "&bigclass=%C8%CB%CE%EF&newcate=1&lvl=" + power + "&password=" + password  'lvl:0私有1公开2半公开

        http.Proc()

        m = r.Match(http.RespHtml, "成功修改目录属性")

        If m.Success Then

            Return True

        Else

            Return False

        End If

    End Function

 

    '删除目录

    Function DeleteAlbum(ByVal albumID As String) As Boolean

        http.strUrl = "http://control.photo.163.com/pholder_del.php?user=" + username + "&aid=" + albumID

        http.Proc()

        m = r.Match(http.RespHtml, "删除目录成功")

        If m.Success Then

            Return True

        Else

            Return False

        End If

    End Function

 

    '上传照片

    Function UpPhoto(ByVal AlbumID As String, ByVal BigPhotoPath As String, ByVal smallPhotoPath As String) As Boolean

        Static sid As String

        If sid = "" Then '获取sid

            http.strUrl = "http://photo.163.com/upload.php?aid=" + AlbumID

            http.Proc()

            m = r.Match(http.RespHtml, "(?<=<param.+name=.*Sid.+value=.*)/w+==")

            If m.Success Then

                sid = m.Value

            Else

                Return False

            End If

 

        End If

        http.strUrl = "http://upload.photo.163.com/AppUpload.do?ApiName=uploadPhoto"

        http.strTextField = "albumId=" + AlbumID + "&sid=" + sid + "&OriginDim=1024;768&SmallerDim=200;200&descr=hedaodewoaininihaoma"

        http.strFileField = "OriginFile=" + BigPhotoPath + "&SmallerFile=" + smallPhotoPath

        http.UploadFile()

 

        m = r.Match(http.RespHtml, "<added>1<")

        If m.Success Then

            Return True

        Else

            sid = ""

            Return False

        End If

    End Function

 

    '修改照片描述

    Function EditPhoto(ByVal albumID As String, ByVal photoID As String, ByVal photoDesc As String) As Boolean

        http.strUrl = "http://photo.163.com/photo_descr_edit.php"

        http.strTextField = "user=" + username + "&aid=" + albumID + "&pid=" + photoID + "&descr=" + photoDesc

        http.Proc()

        If http.RespHtml = "success" Then

            Return True

        Else

            Return False

        End If

    End Function

 

    '删除照片

    Function DeletePhoto(ByVal albumID As String, ByVal photoID As String) As Boolean

        http.strUrl = "http://control.photo.163.com/photo_del.php?user=" + username + "&aid=" + albumID + "&pid=" + photoID

        http.Proc()

        m = r.Match(http.RespHtml, "<added>1<")

        If m.Success Then

            Return True

        Else

            Return False

        End If

    End Function

 

 

 

End Class

Android实现批量照片上传至服务器,拍照或者从相册选择

最近由于项目需求,需要完成批量照片上传,折腾了一段时间,终于完成了,达到了如下效果                                   主界面主要有GridView组成和按钮组成...
  • qianhaifeng2012
  • qianhaifeng2012
  • 2016年04月14日 21:14
  • 6358

如何批量把下载QQ空间相册图片

如何批量下载QQ空间相册的照片,共分为两种方式:电脑端操作方式;手机端操作方式...
  • qq_29164079
  • qq_29164079
  • 2016年09月17日 21:28
  • 18009

js插件+UploadFile类实现图片的批量上传

文件上传无疑是web应用中一个非常常用的功能,下面小编给大家分享一下diyUpload.js+ThinkPHP中的UploadFile类实现图片的批量上传。         首先,给大家介绍展示一下...
  • u010753613
  • u010753613
  • 2015年12月15日 15:42
  • 9674

FTP上传下载源代码 VB.net

  • 2012年05月27日 12:40
  • 92KB
  • 下载

.NET仿QQ相冊批量上傳圖片

  • 2014年03月21日 11:46
  • 40KB
  • 下载

AlbumEasy 163,google相册批量下载工具

  • 2008年12月10日 00:56
  • 188KB
  • 下载

163相册批量下载器.rar

  • 2009年06月02日 22:17
  • 24KB
  • 下载

vb控制vss,批量上传下载

  • 2015年03月14日 13:32
  • 87KB
  • 下载

AlbumCon(百度,163,yahoo相册批量下载工具)

  • 2008年11月20日 10:34
  • 486KB
  • 下载

在我们使用 vb 的 code 编辑器时,其粘贴、复制、剪切按钮能随着当前的选择情况而进行适当的调整,本程序演示了类似的功能作者:jin(kenj@163.net)(3KB)...

  • 2009年10月07日 14:10
  • 2KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:163相册批量上传下载类(vb.net)
举报原因:
原因补充:

(最多只允许输入30个字)