- 博客(1)
- 资源 (7)
- 收藏
- 关注
原创 scrapy爬取某网站,模拟登陆过程中遇到的那些坑
最近接触scrapy,爬取了几个网站,用着还挺顺手的. 前几天,一个做业务的同事让我帮他爬取一个网站上的用户信息,我就满口承诺下来了.毕竟,通过前几次的爬取,已经自信心爆棚了(从此入坑). 拿到一个网站之后就是先分析网站,分析之后发现需要的数据要登陆才能看到.这个可难不倒我,不就是模拟登陆吗,小菜一碟. 用chrome分析一下,看到有用户名,密码,还有其他两个校验值.另外还有一
2016-09-12 11:13:40 18667 7
android Textview 实现html 图片显示
android Textview 实现html 图片点击 两种方式
一种是用webview ,调用jsInterface实现
另一种是 textview 使用Html.from()方法
2015-07-24
picasso 图片库
github 地址 https://github.com/square/picasso
ADAPTER DOWNLOADS
Adapter re-use is automatically detected and the previous download canceled.
@Override public void getView(int position, View convertView, ViewGroup parent) {
SquaredImageView view = (SquaredImageView) convertView;
if (view == null) {
view = new SquaredImageView(context);
}
String url = getItem(position);
Picasso.with(context).load(url).into(view);
}
IMAGE TRANSFORMATIONS
Transform images to better fit into layouts and to reduce memory size.
Picasso.with(context)
.load(url)
.resize(50, 50)
.centerCrop()
.into(imageView)
You can also specify custom transformations for more advanced effects.
public class CropSquareTransformation implements Transformation {
@Override public Bitmap transform(Bitmap source) {
int size = Math.min(source.getWidth(), source.getHeight());
int x = (source.getWidth() - size) / 2;
int y = (source.getHeight() - size) / 2;
Bitmap result = Bitmap.createBitmap(source, x, y, size, size);
if (result != source) {
source.recycle();
}
return result;
}
@Override public String key() { return "square()"; }
}
Pass an instance of this class to the transform method.
PLACE HOLDERS
Picasso supports both download and error placeholders as optional features.
Picasso.with(context)
.load(url)
.placeholder(R.drawable.user_placeholder)
.error(R.drawable.user_placeholder_error)
.into(imageView);
A request will be retried three times before the error placeholder is shown.
RESOURCE LOADING
Resources, assets, files, content providers are all supported as image sources.
Picasso.with(context).load(R.drawable.landing_screen).into(imageView1);
Picasso.with(context).load("file:///android_asset/DvpvklR.png").into(imageView2);
Picasso.with(context).load(new File(...)).into(imageView3);
DEBUG INDICATORS
For development you can enable the display of a colored ribbon which indicates the image source. Call setIndicatorsEnabled(true) on the Picasso instance.
2015-06-19
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人