精华内容
下载资源
问答
  • 涡轮计算机 线性URL文件下载器,使用URLMON库提供完整的URL和DIR自定义 学分 Hoven-较小的代码段的一个不错的基础。 (无链接!) 执照 结束语 用 :heart_with_ribbon: 通过传统主义
  • 线性URL文件下载器,使用URLMON库提供完整的URL和DIR自定义 回购名称是怎么回事? 与github默认存储库名称等的一个小模因... 学分 Hoven-较小的代码段的一个不错的基础。 StackOverflow-... OBV! 安迪-一些下载...
  • URL文件批量下载器.zip

    2021-02-26 00:07:04
    URL文件批量下载工具,使用说明查看readme
  • python3文件下载器

    2020-05-05 18:16:47
    这个下载器用python3写的迅雷啥的有些限速太慢,这个下载挺快的。 使用方法编辑文件中的url连接地址即可 后面path中是文件的本地存放路径。
  • 易语言文件下载器源码例程程序结合易语言扩展界面支持库和网络传送支持库,下载URL地址文件。 可以关联到IE右键菜单
  • java url下载器

    2018-07-01 20:41:09
    正好数学题目做的不想做了,就自己撸了一个url下载器出来。因为没花多少时间,做的比较简单,主要功能就加了一个进度条,在这里记一下,以后要是闲着没事干再改进。运行效果截图:界面UI:package View; import tool...

    最近在一些学校的官网上看考研大纲的时候,发现很多学校官网上面的资源是直接用a标签指向的,似乎是因为没有加download属性,还是文件比较小,没法下载下来。正好数学题目做的不想做了,就写了一个url下载器出来。因为没花多少时间,做的比较简单,主要功能就加了一个进度条,在这里记一下,以后要是闲着没事干再改进。

    运行效果截图:


    界面UI:

    package View;
    
    import tool.FileSave;
    import tool.WindowUtil;
    
    import javax.swing.*;
    import javax.swing.border.EmptyBorder;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    
    /**
     * @author yb
     */
    public class MainView extends JFrame {
        /**
        * 文件存放地址按钮,开始按钮
         * */
        private JButton filechoose,start;
        /**
        * url输入框
        * */
        private JLabel notice;
        private TextField url,name;
        private String savepath;
        private JProgressBar progressBar;
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                @Override
                public void run() {
                    try {
                        UIManager
                                .setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
                        MainView mainView = new MainView();
                        mainView.setVisible(true);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
        }
        public MainView(){
            initview();
        }
    
        private void initview() {
            this.setTitle("url文件下载器");
            setBounds(0, 0, 700, 500);
            WindowUtil.center(this);
            setResizable(false);
    
            JPanel contentPane = new JPanel();
            contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
            contentPane.setBackground(new Color(224, 223, 223));
            setContentPane(contentPane);
            contentPane.setLayout(null);
            setLocationRelativeTo(null);
    
            JPanel featurepel = new JPanel();
            featurepel.setBounds(0, 0, 700, 500);
            featurepel.setBackground(new Color(238, 239, 239));
            contentPane.add(featurepel);
            featurepel.setLayout(null);
    
            filechoose=new JButton("选择存放目录");
            filechoose.setHorizontalAlignment(SwingConstants.LEFT);
            filechoose.setFont(new Font("黑体", Font.PLAIN, 20));
            filechoose.setBounds(20, 240, 150, 40);
            featurepel.add(filechoose);
    
            start=new JButton("下载");
            start.setHorizontalAlignment(SwingConstants.LEFT);
            start.setFont(new Font("黑体", Font.PLAIN, 20));
            start.setBounds(190, 240, 80, 40);
            featurepel.add(start);
    
            JLabel title = new JLabel("输入url地址(带http/https)");
            title.setFont(new Font("黑体", Font.PLAIN, 20));
            title.setBounds(20, 10, 300, 40);
            featurepel.add(title);
    
            url=new TextField();
            url.setFont(new Font("黑体", Font.PLAIN, 20));
            url.setBounds(20, 60, 580, 40);
            featurepel.add(url);
    
            JLabel namelable = new JLabel("文件重命名");
            namelable.setFont(new Font("黑体", Font.PLAIN, 20));
            namelable.setBounds(20, 120, 200, 40);
            featurepel.add(namelable);
    
            name=new TextField(20);
            name.setFont(new Font("黑体", Font.PLAIN, 20));
            name.setBounds(20, 180, 200, 40);
            featurepel.add(name);
    
            JLabel process = new JLabel("进度");
            process.setFont(new Font("黑体", Font.PLAIN, 20));
            process.setBounds(20,300,580,40);
            featurepel.add(process);
    
            progressBar=new JProgressBar();
            progressBar.setFont(new Font("黑体", Font.PLAIN, 20));
            progressBar.setBounds(20,350,580,40);
            progressBar.setForeground(Color.BLUE);
            featurepel.add(progressBar);
    
            notice=new JLabel();
            notice.setFont(new Font("黑体", Font.PLAIN, 20));
            notice.setBounds(20,410,580,40);
            featurepel.add(notice);
            setAction();
        }
    
        private void setAction() {
            // 定义关闭按钮事件
            this.addWindowListener(new WindowAdapter() {
                @Override
                public void windowClosing(WindowEvent e) {
                    System.exit(0);
                }
            });
            filechoose.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    JFileChooser choose = new JFileChooser();
                    choose.setAcceptAllFileFilterUsed(false);
                    choose.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY );
                    choose.showOpenDialog(null);
                    savepath= choose.getSelectedFile().getPath();
                }
            });
            start.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    notice.setText("");
                    progressBar.setValue(0);
                    String filename=name.getText();
                    String fileurl=url.getText();
                    if (filename.equals("")||fileurl.equals("")){
                        JOptionPane.showMessageDialog(null,"Url或名称为空");
                    }else {
                        FileThread thread = new FileThread(filename, fileurl);
                        thread.start();
                    }
                }
            });
        }
        class FileThread extends Thread{
            private String fileurl,filename;
            public FileThread(String name,String url) {
                this.fileurl=url;
                this.filename=name;
            }
    
            @Override
            public void run(){
                FileSave.saveFile(progressBar,savepath,fileurl,filename,notice,name,url);
            }
        }
    
    
    }
    

    文件下载工具类

    package tool;
    
    import javax.swing.*;
    import java.awt.*;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.net.URLConnection;
    /**
    * 文件保存工具类
     * */
    public class FileSave  {
        public static void saveFile(JProgressBar jProgressBar, String path, String url, String name, JLabel notice, TextField namelable, TextField urllable){
    
            FileOutputStream fos = null;
            try {
                //创建URL对象并指定所对应的地址。
                URL download = new URL(url);
                URLConnection conn = download.openConnection();
                Long connLength=conn.getContentLengthLong();
                ProgressBar pbt = new ProgressBar(connLength,jProgressBar,notice);
                //建立输入流获取url的数据。
                InputStream is = download.openStream();
                //建立文件输出流来存储资源。
                int n=url.lastIndexOf(".");
                String type=url.substring(n,url.length());
                String newpath=path+"/"+name+type;
                newpath = newpath.replaceAll("\\\\", "/");
                fos = new FileOutputStream(newpath);
                new Thread(pbt).start();
                int i ;
    //循环判断如果is.read()的值不等于-1,则说明字节流中还存在数值,用fos进行输出。
                while((i=is.read())!=-1){
                    fos.write(i);
                     pbt.updateProgress(i);
                }
                notice.setText("下载成功!");
                namelable.setText("");
                urllable.setText("");
            } catch (IOException e) {
    // TODO Auto-generated catch block
                e.printStackTrace();
            }finally{
    //最后流程结束后进行自动fos的关闭。
                try {
                    assert fos != null;
                    fos.close();
                } catch (IOException e) {
    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
    
            }
    
        }
    }
    

    进度条更新线程:

    package tool;
    
    import javax.swing.*;
    import java.util.ArrayList;
    
    public class ProgressBar extends JPanel implements Runnable {
        private final ArrayList<Integer> proList = new ArrayList<Integer>();
        private int progress;//当前进度
        private long totalSize;//总大小
        private boolean run = true;
        private JProgressBar progressBar;
        private JLabel notice;
        public ProgressBar(long totalSize,JProgressBar progressBar,JLabel notice){
            this.totalSize = totalSize;
            this.progressBar=progressBar;
            this.notice=notice;
            //TODO 创建进度条
        }
        /**
         * @param progress 进度
         */
        public void updateProgress(int progress){
            synchronized (this.proList) {
                if(this.run){
                    this.proList.add(progress);
                    this.proList.notify();
                }
            }
        }
    
        public void finish(){
            this.run = false;
            //关闭进度条
        }
    
    
        @Override
        public void run() {
            synchronized (this.proList) {
                try {
                    while (this.run) {
                        if(this.proList.size()==0){
                            this.proList.wait();
                        }
                        synchronized (proList) {
                            this.progress += this.proList.remove(0);
                            int progress=(int) (this.progress/this.totalSize);
                            if (progress<=100){
                                notice.setText(progress+"%");
                            }else {
                                notice.setText("100%");
                            }
                            progressBar.setValue(progress);
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
    

    ———————————————2018-7-2更新———————————————————

    刚刚开始用就发现了两个问题,这里记录一下,当碰到下载的文件比较大的时候,int,long无法存放文件的长度,进度条展示会出错。

    还有就是有些文件过大,直接下载内存放不下,必须得用多线程去拆分开来下载。

    https://download.csdn.net/download/hunjue0915/10512412

    没积分的话可以私聊我要代码。

    展开全文
  • 根据文件的远程路径将多文件合并成zip压缩包,然后下载到客户端,并解决火狐浏览中文文件名乱码问题,下面是代码 package com.test.util; import java.io.BufferedInputStream; import java.io.IOException; ...

    根据文件的远程路径将多文件合并成zip压缩包,然后下载到客户端,并解决火狐浏览器中文文件名乱码问题,下面是代码

    package com.test.util;
    
    import java.io.BufferedInputStream;
    import java.io.IOException;
    import java.io.UnsupportedEncodingException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLEncoder;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipOutputStream;
    
    import javax.servlet.http.HttpServletResponse;
    
    /**
     * @ClassName: DownLoadUtil
     * @Description: 下载文件到客户端工具类
     * @author xiaojie
     * @date 2019年11月6日 下午10:15:45
     *
     */
    public class DownLoadUtil {
    	public final static String SUFFIX = ".zip";
    
    	public static void downLoad(HttpServletResponse response) {
    		List<String> imageList = new ArrayList<String>();
    		imageList.add("www.baidu.com/image/123.jpg");
    		imageList.add("www.baidu.com/image/2343.jpg");
    		imageList.add("www.baidu.com/image/12345.jpg");
    		BufferedInputStream is = null;
    		ZipOutputStream zos = null;
    		try {
    			String zipName = "保存文件名" + SUFFIX;
    			zipName = URLEncoder.encode(zipName, "UTF-8");
    			// 指明response的返回对象是文件流
    			response.setContentType("application/octet-stream; charset=UTF-8");
    			// 设置在下载框默认显示的文件名,filename*=utf-8'zh_cn'解决火狐浏览器中文名称乱码问题
    			response.setHeader("Content-Disposition", "attachment;filename*=utf-8'zh_cn'" + zipName);
    			zos = new ZipOutputStream(response.getOutputStream());
    			for (String image : imageList) {
    				URL url = new URL(image);
    				is = new BufferedInputStream(url.openStream());
    				zos.putNextEntry(new ZipEntry(image));
    				byte[] buffer = new byte[1024];
    				int r = 0;
    				while ((r = is.read(buffer)) != -1) {
    					zos.write(buffer, 0, r);
    				}
    			}
    		} catch (UnsupportedEncodingException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		} catch (MalformedURLException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		} catch (IOException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		} finally {
    			try {
    				//关闭流
    				is.close();
    				zos.flush();
    				zos.close();
    			} catch (IOException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			}
    		}
    	}
    }
    

     

    展开全文
  • WPF文件下载器

    2021-02-06 08:55:32
    效果图: 核心代码: ... 下载文件 </summary> /// <param name="URL">下载文件地址</param> /// <param name="Filename">下载后的存放地址</param> /// <par.

    效果图:

     

    核心代码:

     class DownloadService
        {
            /// <summary> 下载文件 </summary>        
            /// <param name="URL">下载文件地址</param>  
            /// <param name="Filename">下载后的存放地址</param>        
            /// <param name="Prog">用于显示的进度条</param>        
            /// 
            public static void DownloadFile(string URL, string filename, Action<string, string> percentAction = null, int refreshTime = 1000)
            {
                float percent = 0;
                int total = 0;
                int current = 0;
                HttpWebRequest Myrq = HttpWebRequest.Create(URL) as HttpWebRequest;
                Myrq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705;)";
                //Myrq.Headers.Add("Token", Token);
                HttpWebResponse myrp = (HttpWebResponse)Myrq.GetResponse();
    
                long totalBytes = myrp.ContentLength;
                total = (int)totalBytes;
                Stream st = myrp.GetResponseStream();
                if (File.Exists(filename))
                {
                    ///生成时间戳
                    int index= filename.LastIndexOf('.');
                    string insertStr="["+ System.Text.RegularExpressions.Regex.Replace(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), @"[^\d]*", "") +"]";
                    filename=filename.Insert(index, insertStr);
                }
               
                
                Stream so = new FileStream(filename, FileMode.Create);
    
                long totalDownloadedByte = 0;
                byte[] by = new byte[1024];
    
                int osize = st.Read(by, 0, (int)by.Length);
    
    
                // Todo :定时刷新进度 
                if (percentAction != null)
                {
                    Action action = () =>
                    {
                        while (true)
                        {
                            Thread.Sleep(refreshTime);
    
                            // Todo :返回进度 
                            percentAction(current.ToString(), total.ToString());
    
                            if (current == total) break;
                        }
                    };
    
                    Task task = new Task(action);
                    task.Start();
                }
    
    
                while (osize > 0)
                {
                    totalDownloadedByte = osize + totalDownloadedByte;
                    so.Write(by, 0, osize);
                    current = (int)totalDownloadedByte;
    
                    osize = st.Read(by, 0, (int)by.Length);
    
                    percent = (float)totalDownloadedByte / (float)totalBytes * 100;
                }
                so.Close();
                st.Close();
            }
       
           
        
        }
       private string Log { get; set; }
            private void Download_Click(object sender, RoutedEventArgs e)
            {
                string URL = @"http://vfx.mtime.cn/Video/2019/03/21/mp4/190321153853126488.mp4";
                if (string.IsNullOrEmpty(URL))
                {
                    this.Log = "请求的下载地址是空,请检查!";
                    logTextBlock.Text = Log;
                    return;
                }
                this.updataGrid.Visibility = Visibility.Collapsed;
                this.progressGrid.Visibility = Visibility.Visible;
                string save = "C:\\Update";
    
                if (!Directory.Exists(save))
                {
                    Directory.CreateDirectory(save);
                }
    
                string fileName = System.IO.Path.GetFileName(URL);
    
                string savePath = System.IO.Path.Combine(save, fileName);
    
                Action<string, string> action = (current, total) =>
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        this.Log = $"正在下载...{FormatBytes(long.Parse(current)).PadLeft(10, ' ')},共计{FormatBytes(long.Parse(total))}";
                        logTextBlock.Text = Log;
                        this.progress.Value = (int)((double.Parse(current) / double.Parse(total)) * 100);
    
                        if (current == total)
                        {
                            this.progress.Value = 100;
    
                            Task.Delay(1000).ContinueWith(l =>
                            {
                                this.Dispatcher.Invoke(() =>
                                {
                                    this.Log = $"下载完成!";
                                    logTextBlock.Text = Log;
                                });
    
                            });
    
    
                            var result = MessageBox.Show("是否打开文件?","温馨提示",MessageBoxButton.OKCancel,MessageBoxImage.Question,MessageBoxResult.OK);
    
                            if (result==MessageBoxResult.OK)
                            {
                                Process.Start(savePath);
                            }
                            this.confirmGrid.Visibility = Visibility.Visible;
                            this.updataGrid.Visibility = Visibility.Collapsed;
                            this.progressGrid.Visibility = Visibility.Collapsed;
                        }
                    });
    
                };
    
                Task.Run(() =>
                {
                    DownloadService.DownloadFile(URL, savePath, action, 1000);
                });
            }
    
            public static string FormatBytes(long bytes)
            {
                string[] Suffix = { "Byte", "KB", "MB", "GB", "TB" };
                int i = 0;
                double dblSByte = bytes;
    
                if (bytes > 1024)
                    for (i = 0; (bytes / 1024) > 0; i++, bytes /= 1024)
                        dblSByte = bytes / 1024.0;
    
                return String.Format("{0:0.##}{1}", dblSByte, Suffix[i]);
            }
            private void Confirm_Click(object sender, RoutedEventArgs e)
            {
                this.Close();
            }
    <Window.Resources>
            <LinearGradientBrush StartPoint="0,0" EndPoint="1,1" x:Key="linear">
                <GradientStop Offset="0" Color="#FFCF980C"/>
                <GradientStop Offset="0.5" Color="#FFC59416"/>
                <GradientStop Offset="1" Color="#FFBD8902"/>
            </LinearGradientBrush>
            <Style TargetType="Button" >
                <Setter Property="Cursor" Value="Hand"/>
                <Setter Property="VerticalAlignment" Value="Center"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
                <Setter Property="Foreground" Value="AliceBlue"/>
                <Setter Property="Background" Value="{StaticResource linear}"/>
                <Setter Property="BorderThickness" Value="0" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Button">
                            <Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="0" CornerRadius="5,5,5,5" Background="{StaticResource linear}">
                                <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></ContentPresenter>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value> 
                    
                </Setter>
            </Style>
            <Style TargetType="{x:Type ProgressBar}">
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                <Setter Property="SnapsToDevicePixels" Value="True"/>
                <Setter Property="Height" Value="15"/>
                <Setter Property="Background" Value="{StaticResource linear}"/>
                <Setter Property="FontSize" Value="10"/>
                <Setter Property="Padding" Value="5,0"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ProgressBar}">
                            <Grid Background="#00000000">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualState x:Name="Determinate"/>
                                        <VisualState x:Name="Indeterminate">
                                            <Storyboard RepeatBehavior="Forever">
                                                <PointAnimationUsingKeyFrames Storyboard.TargetName="Animation" Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)">
                                                    <EasingPointKeyFrame KeyTime="0:0:0" Value="0.5,0.5"/>
                                                    <EasingPointKeyFrame KeyTime="0:0:1.5" Value="1.95,0.5"/>
                                                    <EasingPointKeyFrame KeyTime="0:0:3" Value="0.5,0.5"/>
                                                </PointAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
    
                                <Grid Height="{TemplateBinding Height}">
                                    <Border Background="#000000" CornerRadius="7.5" Opacity="0.05"/>
                                    <Border BorderBrush="#000000" BorderThickness="1" CornerRadius="7.5" Opacity="0.1"/>
                                    <Grid Margin="{TemplateBinding BorderThickness}">
                                        <Border x:Name="PART_Track"/>
                                        <Grid x:Name="PART_Indicator" ClipToBounds="True" HorizontalAlignment="Left" >
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition x:Name="width1"/>
                                                <ColumnDefinition x:Name="width2" Width="0"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid x:Name="Animation"  RenderTransformOrigin="0.5,0.5">
                                                <Grid.RenderTransform>
                                                    <TransformGroup>
                                                        <ScaleTransform ScaleY="-1" ScaleX="1"/>
                                                        <SkewTransform AngleY="0" AngleX="0"/>
                                                        <RotateTransform Angle="180"/>
                                                        <TranslateTransform/>
                                                    </TransformGroup>
                                                </Grid.RenderTransform>
                                                <Border Background="{TemplateBinding Background}" CornerRadius="7.5">
                                                    <Viewbox HorizontalAlignment="Left" StretchDirection="DownOnly" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="True">
                                                        <TextBlock Foreground="#ffffff" SnapsToDevicePixels="True" FontSize="{TemplateBinding FontSize}" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Value,StringFormat={}{0}%}" RenderTransformOrigin="0.5,0.5">
                                                            <TextBlock.RenderTransform>
                                                                <TransformGroup>
                                                                    <ScaleTransform ScaleY="1" ScaleX="-1"/>
                                                                    <SkewTransform AngleY="0" AngleX="0"/>
                                                                    <RotateTransform Angle="0"/>
                                                                    <TranslateTransform/>
                                                                </TransformGroup>
                                                            </TextBlock.RenderTransform>
                                                        </TextBlock>
                                                    </Viewbox>
                                                </Border>
                                                <Border BorderBrush="#000000" BorderThickness="1" CornerRadius="7.5" Opacity="0.1"/>
                                            </Grid>
                                        </Grid>
                                    </Grid>
                                </Grid>
                            </Grid>
                            <ControlTemplate.Triggers>
    
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter Property="Background" Value="#c5c5c5"/>
                                </Trigger>
                                <Trigger Property="IsIndeterminate" Value="true">
                                    <Setter TargetName="width1" Property="Width" Value="0.25*"/>
                                    <Setter TargetName="width2" Property="Width" Value="0.725*"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Window.Resources>
        <WindowChrome.WindowChrome>
            <WindowChrome CaptionHeight="50" GlassFrameThickness="1" />
        </WindowChrome.WindowChrome>
        <Grid>
            <Border CornerRadius="5" BorderThickness="2" BorderBrush="White" Margin="-3" >
                <Border.Effect>
                    <DropShadowEffect ShadowDepth="1" Color="#FF414141" BlurRadius="8"/>
                </Border.Effect>
            </Border>
            <Grid Height="289" Margin="0 0 0 0">
               <Grid.RowDefinitions>
                   <RowDefinition Height="1.5*"/>
                   <RowDefinition Height="*"/>
               </Grid.RowDefinitions>
                   <Grid Grid.Row="0" Margin="1 1 1 0" Background="{StaticResource linear}">
                    <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="AliceBlue">
                        <Run Text="发现新版本:   V1.2.6" FontSize="24"/> 
                        <LineBreak/>
                         <LineBreak/>
                        <Run Text="1、增加了更新提示" FontSize="16"/>
                         <LineBreak/> 
                         <Run Text="2、增加了换肤功能" FontSize="16"/>
                         <LineBreak/>
                        <Run Text="3、优化了部分功能" FontSize="16"/>
                    </TextBlock>
                </Grid>
                    <Grid Grid.Row="1" x:Name="updataGrid" >
                       <Button Width="171" Height="38" Content="立即升级"   Click="Download_Click" />
                    </Grid>
                    <Grid Grid.Row="1"  x:Name="progressGrid" Visibility="Collapsed">
                      <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                        <ProgressBar Width="520" Height="24" x:Name="progress" />
                        <TextBlock Width="Auto" Text="正在加载中..." Height="38" x:Name="logTextBlock" HorizontalAlignment="Right"
                               Margin="0 4  10 0 " Foreground="#FF646A70" />
                      </StackPanel>
                   </Grid>
                   <Grid Grid.Row="1" x:Name="confirmGrid" Visibility="Collapsed">
                      <Button Width="171" Height="38" Content="确认关闭"   Click="Confirm_Click" />
                  </Grid>
            </Grid>
        </Grid>

     

    展开全文
  • 通过URL下载PDF文件并调用PDF阅读显示 以及通过WEBVIEW 显示PDF 文件
  • 文件批量下载器

    2017-11-02 16:02:12
    把全部Url资源地址放到记事本里一次性批量下载,存放地址每行一条,多线程下载,有进度条提示
  • I am trying to download files from google drive and all I have is the drive's url.I have read about google api that talks about some drive_service and MedioIO, which also requires some credentials( ma...

    I am trying to download files from google drive and all I have is the drive's url.

    I have read about google api that talks about some drive_service and MedioIO, which also requires some credentials( mainly json file/oauth). But I am unable to get any idea about how its working.

    Also, tried urllib2 urlretrieve, but my case is to get files from drive. Tried 'wget' too but no use.

    Tried pydrive library. It has good upload functions to drive but no download options.

    Any help will be appreciated.

    Thanks.

    解决方案

    If by "drive's url" you mean the shareable link of a file on Google Drive, then the following might help:

    import requests

    def download_file_from_google_drive(id, destination):

    URL = "https://docs.google.com/uc?export=download"

    session = requests.Session()

    response = session.get(URL, params = { 'id' : id }, stream = True)

    token = get_confirm_token(response)

    if token:

    params = { 'id' : id, 'confirm' : token }

    response = session.get(URL, params = params, stream = True)

    save_response_content(response, destination)

    def get_confirm_token(response):

    for key, value in response.cookies.items():

    if key.startswith('download_warning'):

    return value

    return None

    def save_response_content(response, destination):

    CHUNK_SIZE = 32768

    with open(destination, "wb") as f:

    for chunk in response.iter_content(CHUNK_SIZE):

    if chunk: # filter out keep-alive new chunks

    f.write(chunk)

    if __name__ == "__main__":

    file_id = 'TAKE ID FROM SHAREABLE LINK'

    destination = 'DESTINATION FILE ON YOUR DISK'

    download_file_from_google_drive(file_id, destination)

    The snipped does not use pydrive, nor the Google Drive SDK, though. It uses the requests module (which is, somehow, an alternative to urllib2).

    When downloading large files from Google Drive, a single GET request is not sufficient. A second one is needed - see wget/curl large file from google drive.

    展开全文
  • 简易下载器的实现支持代理、失败重试、确保包含指定ID元素(可根据需求自定义修改)# coding: utf-8from Utils import loggingfrom bs4 import BeautifulSoup as bsfrom selenium import webdriverfrom selenium....
  • 多级文件下载器 ![#f03c15]仅用于提供信息和教育目的。 Cigar是一个可创建多阶段程序下载器的工具。此工具将生成其他脚本,更改文件的PE标头中的某些属性并对其进行加密。 要求: 的Python 3.7.x Windows 10 ...
  • 这篇文章主要教大家如何使用Python编写一个优美的下载器,具有一定的参考价值,感兴趣的小伙伴们可以参考一下本文实例为大家分享了Python编写下载器的具体代码,供大家参考,具体内容如下#!/bin/python3# author: ...
  • FileBox是适用于Android的异步文件下载器库。 在开发文件箱之前,尽管URL内容很少更改。因此,基本上,该库下载给定的URL,如果已经下载,则直接提供下载的内容。 FileBox; 与观察者共享正在进行的下载请求。因此...
  • android调用系统下载器下载文件

    千次阅读 2016-09-08 09:33:08
    在项目中使用到了在...得到url文件下载地址  2.使用URL下载:  (1)下载前先判断文件是否已经在下载,避免重复下载:  // 判断该文件是否在下载 private boolean isDowning(String uri) { boolean fla
  • 亿彩文件批量下载器,主要用于对已知的网络文件Url,将其批量下载到本地上,并根据需要自动更名下载后的文件,功能丰富强大;支撑大容量几十万几百万条的下载,支持特殊网址的导入,支持保留网络路径结构功能等等...
  • 今天使用使用FileUtils实现一个简易文件选择器 做了一个简易的 文件下载器,功能很简单,提供目标文件url输入框,和下载后文件保存的磁盘路径及文件名,点击下载即可完成。 主要是—--使用commons-io-2.5.jar,这...
  • 转到文件下载器

    2013-08-23 06:20:38
    file_url, "url", "", "URL of the file to download") flag.StringVar(&filename, "filename", "", "Name of downloaded file") flag.IntVar(&workers, "workers", 2, "Number of download workers") } ...
  • 这些是YouTube视频或音频文件的网址,因此您可以流式传输或下载它们。 它具有年龄验证规避和签名解密方法(主要用于vevo视频)的功能。 构建: 依赖关系: Gradle 始终从具有所有更新的最新提交进行构建。 添加...
  • 参数输入对话框是特意为新建一个下载时输入各项参数时编写的对话框,在其内部进行URL的输入、下载线程数的输入和下载文件的保存位置的输入或者选择;程序主类的作用主要是搭建主要窗口,以及将参数输入的结果、下载...
  • 并发http文件下载器,支持速率限制,从断点恢复。 安装 go get github.com/ejunjsh/dl 用法 # dl usage: dl [--header <header> [ --header ]] [[rate limit:]url...] --header: specify your http header,format ...
  • Python爬虫架构Python 爬虫架构主要由五个部分组成,分别是调度器、URL管理器、网页下载器、网页解析器、应用程序(爬取的有价值数据)。调度器:相当于一台电脑的CPU,主要负责调度URL管理器、下载器、解析器之间的...
  • 使用说明: 1)远端更新服务器目录 Package  |----list.txt  |----a.bundle  |----b.bundle ...2)list.txt是更新列表文件 ...(a.bundle是要拼的url,res/a.bundle是要被写在cache的路径) ...
  • 主要介绍了php实现的css文件背景图片下载器代码,涉及文件URL地址的操作,是非常实用的技巧,需要的朋友可以参考下
  • 总体内容在学习下面的知识前请在 mac电脑搭建一下 Apache 服务器1、NSURLConncetion 下载2、NSURLSession下载大文件3、下载管理(多文件下载)一、NSURLConncetion 下载1.1、我们先使用NSURLConncetion 下载一个视频...
  • (如果对任何人都重要的话,我使用的是python3.6.6)我...在我已经制作了一个控制台版本:from tqdm import tqdmimport requests, os, sys, zipfile, shutil, subprocesschunk_size = 1024url = "{LINK TO FILE YOU W...
  • vc编写多线程文件下载器

    千次阅读 2010-09-02 17:37:00
     今天写了个多线程的文件下载器,可以自定义线程数,不废话,看代码: #include #include "windows.h" #include "wininet.h" using namespace std; #pragma comment(lib,"wininet.lib") struct ...
  • 源文件http://theday.guohongfu.top/letter.txt内容为abcdefghijklmnopqrstuvwxyz获取第20字节及以后的内容import requestsurl = 'http://theday.guohongfu.top/letter.txt'headers1 = {'Range': "bytes=20-" # ...
  • 拦截+文件上传下载 拦截 概述 SpringMVC的处理器拦截类似于Servlet开发中的过滤Filter,用于对处理器进行预处理和后处理。开发者可以自己定义一些拦截来实现特定的功能。 **过滤与拦截的区别:**拦截...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 1,522
精华内容 608
关键字:

url文件下载器